add tenant
This commit is contained in:
parent
1e9d22483c
commit
81ba2655b3
41
openapi.yaml
41
openapi.yaml
@ -64,6 +64,44 @@ paths:
|
||||
$ref: '#/components/schemas/Account'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/tenants:
|
||||
get:
|
||||
tags: [ "Tenant" ]
|
||||
summary: Return all normalized tenants
|
||||
operationId: account.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: account.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:
|
||||
securitySchemes:
|
||||
@ -119,6 +157,3 @@ components:
|
||||
type: string
|
||||
account:
|
||||
type: integer
|
||||
TenantJoint:
|
||||
description: TenantJoint
|
||||
type: object
|
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, )
|
||||
}
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user