From ab365c65a15779b190d334948ff5b2a02bdc2594 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 21 Jan 2022 20:46:28 +0100 Subject: [PATCH] add fiscal_year, drop due_to --- api/methods.py | 14 +++++++------- api/openapi.yaml | 5 ++--- api/test.py | 2 +- schema.json | 2 +- schema/create.sql | 2 +- ui/hv2-ui/src/app/data-objects.ts | 4 ++-- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/api/methods.py b/api/methods.py index 75ada88..942b97e 100644 --- a/api/methods.py +++ b/api/methods.py @@ -1365,7 +1365,7 @@ SELECT ,description ,account ,created_at - ,due_at + ,fiscal_year ,amount ,document_no ,account_entry_category @@ -1383,7 +1383,7 @@ def insert_account_entry(user, token_info, **args): v_description = body["description"] v_account = body["account"] v_created_at = body["created_at"] - v_due_at = body["due_at"] + v_fiscal_year = body["fiscal_year"] v_amount = body["amount"] v_document_no = body["document_no"] v_account_entry_category = body["account_entry_category"] @@ -1394,7 +1394,7 @@ INSERT INTO account_entry_t description ,account ,created_at - ,due_at + ,fiscal_year ,amount ,document_no ,account_entry_category @@ -1413,7 +1413,7 @@ INSERT INTO account_entry_t v_description ,v_account ,v_created_at - ,v_due_at + ,v_fiscal_year ,v_amount ,v_document_no ,v_account_entry_category @@ -1432,7 +1432,7 @@ SELECT ,description ,account ,created_at - ,due_at + ,fiscal_year ,amount ,document_no ,account_entry_category @@ -1453,7 +1453,7 @@ SELECT ,description ,account ,created_at - ,due_at + ,fiscal_year ,amount ,document_no ,account_entry_category @@ -1474,7 +1474,7 @@ SELECT ,description ,account ,created_at - ,due_at + ,fiscal_year ,amount ,document_no ,account_entry_category diff --git a/api/openapi.yaml b/api/openapi.yaml index a203e1e..5b3c0f8 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1793,9 +1793,8 @@ components: type: integer created_at: type: string - due_at: - type: string - nullable: true + fiscal_year: + type: integer amount: type: number document_no: diff --git a/api/test.py b/api/test.py index d6c698a..b42a955 100644 --- a/api/test.py +++ b/api/test.py @@ -5,6 +5,6 @@ from flask_cors import CORS logging.basicConfig(level=logging.DEBUG) app = connexion.App('hv2-api') -app.add_api('./openapi.yaml') +app.add_api('./openapi.yaml', options = {"swagger_ui": True}) CORS(app.app) app.run(port=8080) diff --git a/schema.json b/schema.json index 36bd926..b39d272 100644 --- a/schema.json +++ b/schema.json @@ -138,7 +138,7 @@ { "name": "description", "sqltype": "varchar(1024)", "notnull": true }, { "name": "account", "sqltype": "integer", "notnull": true, "foreignkey": true }, { "name": "created_at", "sqltype": "timestamp", "notnull": true, "default": "now()", "selector": 0 }, - { "name": "due_at", "sqltype": "timestamp", "notnull": false }, + { "name": "fiscal_year", "sqltype": "integer", "notnull": true }, { "name": "amount", "sqltype": "numeric(10,2)", "notnull": true }, { "name": "document_no", "sqltype": "integer", "unique": true }, { "name": "account_entry_category", "sqltype": "integer", "notnull": true, "foreignkey": true } diff --git a/schema/create.sql b/schema/create.sql index 2f0f708..2e318d8 100644 --- a/schema/create.sql +++ b/schema/create.sql @@ -150,7 +150,7 @@ CREATE TABLE account_entry_t ( ,description varchar(1024) not null ,account integer not null references account_t (id) ,created_at timestamp not null default now() - ,due_at timestamp + ,fiscal_year integer not null ,amount numeric(10,2) not null ,document_no integer unique ,account_entry_category integer not null references account_entry_category_t (id) diff --git a/ui/hv2-ui/src/app/data-objects.ts b/ui/hv2-ui/src/app/data-objects.ts index a7946a3..7156e49 100644 --- a/ui/hv2-ui/src/app/data-objects.ts +++ b/ui/hv2-ui/src/app/data-objects.ts @@ -193,7 +193,7 @@ export interface AccountEntry { description: string account: number created_at: string - due_at: string + fiscal_year: number amount: number document_no: number account_entry_category: number @@ -203,7 +203,7 @@ export const NULL_AccountEntry: AccountEntry = { ,description: '' ,account: undefined ,created_at: '' - ,due_at: '' + ,fiscal_year: undefined ,amount: undefined ,document_no: undefined ,account_entry_category: undefined