Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b6c33534f1
|
|||
67c97ed4bc
|
|||
81ba2655b3
|
|||
1e9d22483c
|
216
openapi.yaml
216
openapi.yaml
@ -64,6 +64,158 @@ paths:
|
||||
$ref: '#/components/schemas/Account'
|
||||
security:
|
||||
- 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']
|
||||
/v1/commercialPremises:
|
||||
get:
|
||||
tags: [ "CommercialPremise" ]
|
||||
summary: Return all normalized commercial premises
|
||||
operationId: rentalObjects.getCommercialPremises
|
||||
responses:
|
||||
'200':
|
||||
description: commercial premise response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/CommercialPremise'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/commercialPremises/{commercialPremiseId}:
|
||||
get:
|
||||
tags: [ "CommercialPremise" ]
|
||||
summary: Return the normalized commercial premise with given id
|
||||
operationId: rentalObjects.getCommercialPremise
|
||||
parameters:
|
||||
- name: commercialPremiseId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: commercial premise response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/CommercialPremise'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/parkings:
|
||||
get:
|
||||
tags: [ "Parking" ]
|
||||
summary: Return all normalized parkings
|
||||
operationId: rentalObjects.getParkings
|
||||
responses:
|
||||
'200':
|
||||
description: parkings response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Parking'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/parkings/{parkingId}:
|
||||
get:
|
||||
tags: [ "Parking" ]
|
||||
summary: Return the normalized parking with given id
|
||||
operationId: rentalObjects.getParking
|
||||
parameters:
|
||||
- name: parkingId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: parking response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Parking'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/flats:
|
||||
get:
|
||||
tags: [ "Flat" ]
|
||||
summary: Return all normalized flats
|
||||
operationId: rentalObjects.getFlats
|
||||
responses:
|
||||
'200':
|
||||
description: flat response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Flat'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/flats/{flatId}:
|
||||
get:
|
||||
tags: [ "Flat" ]
|
||||
summary: Return the normalized flat with given id
|
||||
operationId: rentalObjects.getFlat
|
||||
parameters:
|
||||
- name: flatId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: flat response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Flat'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
@ -89,3 +241,67 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
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
|
||||
CommercialPremise:
|
||||
description: CommercialPremise
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
premise:
|
||||
type: integer
|
||||
Parking:
|
||||
description: Parking
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
premise:
|
||||
type: integer
|
||||
Flat:
|
||||
description: Flat
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
premise:
|
||||
type: integer
|
||||
area:
|
||||
type: number
|
||||
flat_no:
|
||||
type: integer
|
||||
|
71
rentalObjects.py
Normal file
71
rentalObjects.py
Normal file
@ -0,0 +1,71 @@
|
||||
from db import dbGetMany, dbGetOne
|
||||
|
||||
def getCommercialPremises(user, token_info):
|
||||
return dbGetMany(user, token_info,
|
||||
{
|
||||
"statement": """
|
||||
SELECT id, description, premise
|
||||
FROM commercial_premise_t
|
||||
""",
|
||||
"params": ()
|
||||
}
|
||||
)
|
||||
|
||||
def getCommercialPremise(user, token_info, commercialPremiseId=None):
|
||||
return dbGetOne(user, token_info,
|
||||
{
|
||||
"statement": """
|
||||
SELECT id, description, premise
|
||||
FROM commercial_premise_t
|
||||
WHERE id = %s
|
||||
""",
|
||||
"params": (commercialPremiseId, )
|
||||
}
|
||||
)
|
||||
|
||||
def getFlats(user, token_info):
|
||||
return dbGetMany(user, token_info,
|
||||
{
|
||||
"statement": """
|
||||
SELECT id, description, premise, area, flat_no
|
||||
FROM flat_t
|
||||
""",
|
||||
"params": ()
|
||||
}
|
||||
)
|
||||
|
||||
def getFlat(user, token_info, flatId=None):
|
||||
return dbGetOne(user, token_info,
|
||||
{
|
||||
"statement": """
|
||||
SELECT id, description, premise, area, flat_no
|
||||
FROM flat_t
|
||||
WHERE id = %s
|
||||
""",
|
||||
"params": (flatId, )
|
||||
}
|
||||
)
|
||||
|
||||
def getParking(user, token_info):
|
||||
return dbGetMany(user, token_info,
|
||||
{
|
||||
"statement": """
|
||||
SELECT id, description, premise
|
||||
FROM parking_t
|
||||
""",
|
||||
"params": ()
|
||||
}
|
||||
)
|
||||
|
||||
def getParking(user, token_info, parkingId=None):
|
||||
return dbGetOne(user, token_info,
|
||||
{
|
||||
"statement": """
|
||||
SELECT id, description, premise
|
||||
FROM parking_t
|
||||
WHERE id = %s
|
||||
""",
|
||||
"params": (parkingId, )
|
||||
}
|
||||
)
|
||||
|
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