Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
67c97ed4bc
|
|||
81ba2655b3
|
|||
1e9d22483c
|
68
openapi.yaml
68
openapi.yaml
@ -64,6 +64,44 @@ paths:
|
|||||||
$ref: '#/components/schemas/Account'
|
$ref: '#/components/schemas/Account'
|
||||||
security:
|
security:
|
||||||
- jwt: ['secret']
|
- jwt: ['secret']
|
||||||
|
/v1/tenants:
|
||||||
|
get:
|
||||||
|
tags: [ "Tenant" ]
|
||||||
|
summary: Return all normalized tenants
|
||||||
|
operationId: tenant.getTenants
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: tenant response
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Tenant'
|
||||||
|
security:
|
||||||
|
- jwt: ['secret']
|
||||||
|
/v1/tenants/{tenantId}:
|
||||||
|
get:
|
||||||
|
tags: [ "Tenant" ]
|
||||||
|
summary: Return the normalized tenant with given id
|
||||||
|
operationId: tenant.getTenant
|
||||||
|
parameters:
|
||||||
|
- name: tenantId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: tenants response
|
||||||
|
content:
|
||||||
|
'application/json':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Tenant'
|
||||||
|
security:
|
||||||
|
- jwt: ['secret']
|
||||||
|
|
||||||
components:
|
components:
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
@ -89,3 +127,33 @@ components:
|
|||||||
type: integer
|
type: integer
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
Tenant:
|
||||||
|
description: Tenant
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
salutation:
|
||||||
|
type: string
|
||||||
|
firstname:
|
||||||
|
type: string
|
||||||
|
lastname:
|
||||||
|
type: string
|
||||||
|
address1:
|
||||||
|
type: string
|
||||||
|
address2:
|
||||||
|
type: string
|
||||||
|
address3:
|
||||||
|
type: string
|
||||||
|
zip:
|
||||||
|
type: string
|
||||||
|
city:
|
||||||
|
type: string
|
||||||
|
phone1:
|
||||||
|
type: string
|
||||||
|
phone2:
|
||||||
|
type: string
|
||||||
|
iban:
|
||||||
|
type: string
|
||||||
|
account:
|
||||||
|
type: integer
|
||||||
|
29
tenant.py
Normal file
29
tenant.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from db import dbGetMany, dbGetOne
|
||||||
|
|
||||||
|
def getTenants(user, token_info):
|
||||||
|
return dbGetMany(user, token_info,
|
||||||
|
{
|
||||||
|
"statement": """
|
||||||
|
SELECT id, salutation, firstname, lastname,
|
||||||
|
address1, address2, address3, zip, city,
|
||||||
|
phone1, phone2, iban, account
|
||||||
|
FROM tenant_t
|
||||||
|
""",
|
||||||
|
"params": ()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
def getTenant(user, token_info, tenantId=None):
|
||||||
|
return dbGetOne(user, token_info,
|
||||||
|
{
|
||||||
|
"statement": """
|
||||||
|
SELECT id, salutation, firstname, lastname,
|
||||||
|
address1, address2, address3, zip, city,
|
||||||
|
phone1, phone2, iban, account
|
||||||
|
FROM tenant_t
|
||||||
|
WHERE id = %s
|
||||||
|
""",
|
||||||
|
"params": (tenantId, )
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
Reference in New Issue
Block a user