This commit is contained in:
2021-09-10 11:59:08 +02:00
parent 554a809ba4
commit 2da6b667bc
25 changed files with 436 additions and 108 deletions

View File

@ -1234,6 +1234,64 @@ SELECT
}
)
def get_account_entry_categorys(user, token_info):
return dbGetMany(user, token_info, {
"statement": """
SELECT
id
,description
,overhead_relevant
FROM account_entry_category_t
ORDER BY
description
""",
"params": ()
}
)
def insert_account_entry_category(user, token_info, **args):
try:
body = args["body"]
v_description = body["description"]
v_overhead_relevant = body["overhead_relevant"]
return dbInsert(user, token_info, {
"statement": """
INSERT INTO account_entry_category_t
(
description
,overhead_relevant
) VALUES (
%s
,%s
)
RETURNING *
""",
"params": [
v_description
,v_overhead_relevant
]
})
except KeyError as e:
logger.warning("insert_account_entry_category: parameter missing: {}".format(e))
raise werkzeug.exceptions.UnprocessableEntity("parameter missing: {}".format(e))
def get_account_entry_category(user, token_info, account_entry_categoryId=None):
return dbGetOne(user, token_info, {
"statement": """
SELECT
id
,description
,overhead_relevant
FROM account_entry_category_t
WHERE id = %s
""",
"params": (account_entry_categoryId, )
}
)
def get_account_entrys(user, token_info):
return dbGetMany(user, token_info, {
"statement": """
@ -1243,6 +1301,7 @@ SELECT
,account
,created_at
,amount
,account_entry_category
FROM account_entry_t
ORDER BY
amount
@ -1258,6 +1317,7 @@ def insert_account_entry(user, token_info, **args):
v_account = body["account"]
v_created_at = body["created_at"]
v_amount = body["amount"]
v_account_entry_category = body["account_entry_category"]
return dbInsert(user, token_info, {
"statement": """
INSERT INTO account_entry_t
@ -1266,11 +1326,13 @@ INSERT INTO account_entry_t
,account
,created_at
,amount
,account_entry_category
) VALUES (
%s
,%s
,%s
,%s
,%s
)
RETURNING *
""",
@ -1279,6 +1341,7 @@ INSERT INTO account_entry_t
,v_account
,v_created_at
,v_amount
,v_account_entry_category
]
})
except KeyError as e:
@ -1295,6 +1358,7 @@ SELECT
,account
,created_at
,amount
,account_entry_category
FROM account_entry_t
WHERE id = %s
""",
@ -1313,6 +1377,7 @@ SELECT
,account
,created_at
,amount
,account_entry_category
FROM account_entry_t
WHERE account = %s
""",
@ -1320,6 +1385,23 @@ SELECT
}
)
def get_account_entry_by_account_entry_category(user, token_info, account_entry_categoryId=None):
return dbGetMany(user, token_info, {
"statement": """
SELECT
id
,description
,account
,created_at
,amount
,account_entry_category
FROM account_entry_t
WHERE account_entry_category = %s
""",
"params": (account_entry_categoryId, )
}
)
def get_notes(user, token_info):
return dbGetMany(user, token_info, {
"statement": """

View File

@ -1175,6 +1175,65 @@ paths:
$ref: '#/components/schemas/tenancy_fee_mapping'
security:
- jwt: ['secret']
/v1/account_entry_categorys:
get:
tags: [ "account_entry_category" ]
summary: Return all normalized account_entry_categorys
operationId: methods.get_account_entry_categorys
responses:
'200':
description: account_entry_categorys response
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/account_entry_category'
security:
- jwt: ['secret']
post:
tags: [ "account_entry_category" ]
summary: Insert a account_entry_category
operationId: methods.insert_account_entry_category
requestBody:
description: account_entry_category
content:
application/json:
schema:
$ref: '#/components/schemas/account_entry_category'
responses:
'200':
description: account_entry_category successfully inserted
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/account_entry_category'
security:
- jwt: ['secret']
/v1/account_entry_categorys/{account_entry_categoryId}:
get:
tags: [ "account_entry_category" ]
summary: Return the normalized account_entry_category with given id
operationId: methods.get_account_entry_category
parameters:
- name: account_entry_categoryId
in: path
required: true
schema:
type: integer
responses:
'200':
description: account_entry_category response
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/account_entry_category'
security:
- jwt: ['secret']
/v1/account_entrys:
get:
tags: [ "account_entry" ]
@ -1256,6 +1315,28 @@ paths:
$ref: '#/components/schemas/account_entry'
security:
- jwt: ['secret']
/v1/account_entrys/account_entry_category/{account_entry_categoryId}:
get:
tags: [ "account_entry", "account_entry_category" ]
summary: Return account_entry by $account_entry_category
operationId: methods.get_account_entry_by_account_entry_category
parameters:
- name: account_entry_categoryId
in: path
required: true
schema:
type: integer
responses:
'200':
description: account_entry response
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/account_entry'
security:
- jwt: ['secret']
/v1/notes:
get:
tags: [ "note" ]
@ -1578,6 +1659,16 @@ components:
type: integer
fee:
type: integer
account_entry_category:
description: account_entry_category
type: object
properties:
id:
type: integer
description:
type: string
overhead_relevant:
type: boolean
account_entry:
description: account_entry
type: object
@ -1592,6 +1683,8 @@ components:
type: string
amount:
type: number
account_entry_category:
type: integer
note:
description: note
type: object