diff --git a/api/additional_endpoints.yaml b/api/additional_endpoints.yaml new file mode 100644 index 0000000..123d1f8 --- /dev/null +++ b/api/additional_endpoints.yaml @@ -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'] diff --git a/api/additional_methods.py b/api/additional_methods.py new file mode 100644 index 0000000..133d3ac --- /dev/null +++ b/api/additional_methods.py @@ -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, ) + } + ) + diff --git a/api/openapi.yaml b/api/openapi.yaml index 2e5fc3e..cffd251 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -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: diff --git a/api/openapi.yaml.tmpl b/api/openapi.yaml.tmpl index 87f1074..697da27 100644 --- a/api/openapi.yaml.tmpl +++ b/api/openapi.yaml.tmpl @@ -105,6 +105,8 @@ paths: #end if #end for +#include raw "./api/additional_endpoints.yaml" + components: securitySchemes: jwt: