overhead account stuff

This commit is contained in:
2021-11-08 21:04:21 +01:00
parent ba63874a18
commit 28e505f570
17 changed files with 204 additions and 41 deletions

View File

@ -110,4 +110,21 @@
$ref: '#/components/schemas/account'
security:
- jwt: ['secret']
/v1/uniquenumber:
get:
tags: [ "uniquenumber" ]
summary: Returns a unique number
operationId: additional_methods.get_unique_number
responses:
'200':
description: get_unique_number
content:
'application/json':
schema:
type: object
properties:
number:
type: number
security:
- jwt: ['secret']

View File

@ -54,3 +54,10 @@ SELECT a.id ,a.description
}
)
def get_unique_number(user, token_info):
return dbGetOne(user, token_info, {
"statement": """
SELECT nextval('unique_number_s') AS "number"
""",
"params": ()
})

View File

@ -283,6 +283,7 @@ SELECT
,street
,zip
,city
,account
FROM premise_t
ORDER BY
description
@ -298,6 +299,7 @@ def insert_premise(user, token_info, **args):
v_street = body["street"]
v_zip = body["zip"]
v_city = body["city"]
v_account = body["account"]
return dbInsert(user, token_info, {
"statement": """
INSERT INTO premise_t
@ -306,11 +308,13 @@ INSERT INTO premise_t
,street
,zip
,city
,account
) VALUES (
%s
,%s
,%s
,%s
,%s
)
RETURNING *
""",
@ -319,6 +323,7 @@ INSERT INTO premise_t
,v_street
,v_zip
,v_city
,v_account
]
})
except KeyError as e:
@ -335,6 +340,7 @@ SELECT
,street
,zip
,city
,account
FROM premise_t
WHERE id = %s
""",
@ -373,6 +379,23 @@ UPDATE premise_t
raise werkzeug.exceptions.UnprocessableEntity("parameter missing: {}".format(e))
def get_premise_by_account(user, token_info, accountId=None):
return dbGetMany(user, token_info, {
"statement": """
SELECT
id
,description
,street
,zip
,city
,account
FROM premise_t
WHERE account = %s
""",
"params": (accountId, )
}
)
def get_flats(user, token_info):
return dbGetMany(user, token_info, {
"statement": """
@ -1301,6 +1324,7 @@ SELECT
,account
,created_at
,amount
,document_no
,account_entry_category
FROM account_entry_t
ORDER BY
@ -1317,6 +1341,7 @@ def insert_account_entry(user, token_info, **args):
v_account = body["account"]
v_created_at = body["created_at"]
v_amount = body["amount"]
v_document_no = body["document_no"]
v_account_entry_category = body["account_entry_category"]
return dbInsert(user, token_info, {
"statement": """
@ -1326,6 +1351,7 @@ INSERT INTO account_entry_t
,account
,created_at
,amount
,document_no
,account_entry_category
) VALUES (
%s
@ -1333,6 +1359,7 @@ INSERT INTO account_entry_t
,%s
,%s
,%s
,%s
)
RETURNING *
""",
@ -1341,6 +1368,7 @@ INSERT INTO account_entry_t
,v_account
,v_created_at
,v_amount
,v_document_no
,v_account_entry_category
]
})
@ -1358,6 +1386,7 @@ SELECT
,account
,created_at
,amount
,document_no
,account_entry_category
FROM account_entry_t
WHERE id = %s
@ -1377,6 +1406,7 @@ SELECT
,account
,created_at
,amount
,document_no
,account_entry_category
FROM account_entry_t
WHERE account = %s
@ -1394,6 +1424,7 @@ SELECT
,account
,created_at
,amount
,document_no
,account_entry_category
FROM account_entry_t
WHERE account_entry_category = %s

View File

@ -299,6 +299,28 @@ paths:
$ref: '#/components/schemas/premise'
security:
- jwt: ['secret']
/v1/premises/account/{accountId}:
get:
tags: [ "premise", "account" ]
summary: Return premise by $account
operationId: methods.get_premise_by_account
parameters:
- name: accountId
in: path
required: true
schema:
type: integer
responses:
'200':
description: premise response
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/premise'
security:
- jwt: ['secret']
/v1/flats:
get:
tags: [ "flat" ]
@ -1531,6 +1553,23 @@ paths:
$ref: '#/components/schemas/account'
security:
- jwt: ['secret']
/v1/uniquenumber:
get:
tags: [ "uniquenumber" ]
summary: Returns a unique number
operationId: additional_methods.get_unique_number
responses:
'200':
description: get_unique_number
content:
'application/json':
schema:
type: object
properties:
number:
type: number
security:
- jwt: ['secret']
components:
@ -1605,6 +1644,8 @@ components:
type: string
city:
type: string
account:
type: integer
flat:
description: flat
type: object
@ -1751,6 +1792,9 @@ components:
type: string
amount:
type: number
document_no:
type: integer
nullable: true
account_entry_category:
type: integer
note: