additional endpoint mechanism and overhead advance mapping by flat method

This commit is contained in:
Wolfgang Hottgenroth 2021-09-08 12:18:09 +02:00
parent cf35af9c1e
commit 1335f0f059
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
4 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,29 @@
# -------------------------------------------------------------------
# ATTENTION: This file will not be parsed by Cheetah
# Use plain openapi/yaml syntax, no Cheetah
# escaping
# -------------------------------------------------------------------
/v1/overhead_advance_flat_mappings/flat/{flatId}:
get:
tags: [ "overhead_advance_flat_mapping", "flat" ]
summary: Returns all overhead advance mappings for a given flat
operationId: additional_methods.get_overhead_advance_flat_mapping_by_flat
parameters:
- name: flatId
in: path
required: true
schema:
type: integer
responses:
'200':
description: $table.name response
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/overhead_advance_flat_mapping'
security:
- jwt: ['secret']

19
api/additional_methods.py Normal file
View File

@ -0,0 +1,19 @@
from db import dbGetMany, dbGetOne, dbInsert, dbUpdate
from loguru import logger
import werkzeug
def get_overhead_advance_flat_mapping_by_flat(user, token_info, flatId=None):
return dbGetOne(user, token_info, {
"statement": """
SELECT
id
,overhead_advance
,flat
FROM overhead_advance_flat_mapping_t
WHERE flat = %s
""",
"params": (flatId, )
}
)

View File

@ -971,6 +971,36 @@ paths:
security:
- jwt: ['secret']
# -------------------------------------------------------------------
# ATTENTION: This file will not be parsed by Cheetah
# Use plain openapi/yaml syntax, no Cheetah
# escaping
# -------------------------------------------------------------------
/v1/overhead_advance_flat_mappings/flat/{flatId}:
get:
tags: [ "overhead_advance_flat_mapping", "flat" ]
summary: Returns all overhead advance mappings for a given flat
operationId: additional_methods.get_overhead_advance_flat_mapping_by_flat
parameters:
- name: flatId
in: path
required: true
schema:
type: integer
responses:
'200':
description: $table.name response
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/overhead_advance_flat_mapping'
security:
- jwt: ['secret']
components:
securitySchemes:
jwt:

View File

@ -105,6 +105,8 @@ paths:
#end if
#end for
#include raw "./api/additional_endpoints.yaml"
components:
securitySchemes:
jwt: