generate endpoint for all foreign key relationships

This commit is contained in:
2021-09-08 12:33:26 +02:00
parent 1335f0f059
commit bb2aaa1e84
6 changed files with 551 additions and 58 deletions

View File

@ -103,6 +103,32 @@ paths:
security:
- jwt: ['secret']
#end if
#for $column in $table.columns
#if (('foreignkey' in $column) and $column.foreignkey)
/v1/${table.name}s/${column.name}/{${column.name}Id}:
get:
tags: [ "$table.name", "$column.name" ]
summary: Return $table.name by $$column.name
operationId: methods.get_${table.name}_by_${column.name}
parameters:
- name: ${column.name}Id
in: path
required: true
schema:
type: integer
responses:
'200':
description: $table.name response
content:
'application/json':
schema:
type: array
items:
\$ref: '#/components/schemas/$table.name'
security:
- jwt: ['secret']
#end if
#end for
#end for
#include raw "./api/additional_endpoints.yaml"