diff --git a/flatisfy/models/flat.py b/flatisfy/models/flat.py index df67f7a..3111f2d 100644 --- a/flatisfy/models/flat.py +++ b/flatisfy/models/flat.py @@ -10,7 +10,9 @@ import logging import arrow import enum -from sqlalchemy import Column, DateTime, Enum, Float, String, Text +from sqlalchemy import ( + Column, DateTime, Enum, Float, SmallInteger, String, Text +) from flatisfy.database.base import BASE from flatisfy.database.types import MagicJSON @@ -77,6 +79,7 @@ class Flat(BASE): urls = Column(MagicJSON) merged_ids = Column(MagicJSON) notes = Column(Text) + notation = Column(SmallInteger, default=0) # Flatisfy data # TODO: Should be in another table with relationships diff --git a/flatisfy/web/app.py b/flatisfy/web/app.py index 2709dbd..0428d58 100644 --- a/flatisfy/web/app.py +++ b/flatisfy/web/app.py @@ -80,6 +80,8 @@ def get_app(config): api_routes.update_flat_status_v1) app.route("/api/v1/flat/:flat_id/notes", "POST", api_routes.update_flat_notes_v1) + app.route("/api/v1/flat/:flat_id/notation", "POST", + api_routes.update_flat_notation_v1) app.route("/api/v1/search", "POST", api_routes.search_v1) diff --git a/flatisfy/web/js_src/api/index.js b/flatisfy/web/js_src/api/index.js index 1c59ebb..4dfbba8 100644 --- a/flatisfy/web/js_src/api/index.js +++ b/flatisfy/web/js_src/api/index.js @@ -88,6 +88,24 @@ export const updateFlatNotes = function (flatId, newNotes, callback) { }) } +export const updateFlatNotation = function (flatId, newNotation, callback) { + fetch( + '/api/v1/flat/' + encodeURIComponent(flatId) + '/notation', + { + credentials: 'same-origin', + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + notation: newNotation + }) + } + ).then(callback).catch(function (ex) { + console.error('Unable to update flat notation: ' + ex) + }) +} + export const getTimeToPlaces = function (callback) { fetch('/api/v1/time_to/places', { credentials: 'same-origin' }) .then(function (response) { diff --git a/flatisfy/web/js_src/components/flatstable.vue b/flatisfy/web/js_src/components/flatstable.vue index 20e2556..75e837a 100644 --- a/flatisfy/web/js_src/components/flatstable.vue +++ b/flatisfy/web/js_src/components/flatstable.vue @@ -36,7 +36,7 @@ -