Исправления
This commit is contained in:
18
kv/crud.py
18
kv/crud.py
@ -5,7 +5,7 @@ from kv import schemas
|
||||
|
||||
|
||||
def exec_procedure(session, proc_name, params, database: str = None):
|
||||
sql_params = ",".join(["@{0}={1}".format(name, value)
|
||||
sql_params = ",".join([f"@{name}='{value}'" if type(value) in [str] else f"@{name}={value}"
|
||||
for name, value in params.items()])
|
||||
dbstr = ""
|
||||
if database:
|
||||
@ -20,7 +20,7 @@ def exec_procedure(session, proc_name, params, database: str = None):
|
||||
|
||||
|
||||
def exec_procedure_wo_result(session, proc_name, params, database: str = None):
|
||||
sql_params = ",".join(["@{0}={1}".format(name, value)
|
||||
sql_params = ",".join([f"@{name}='{value}'" if type(value) in [str] else f"@{name}={value}"
|
||||
for name, value in params.items()])
|
||||
dbstr = ""
|
||||
if database:
|
||||
@ -113,7 +113,8 @@ class ObjectViewSet:
|
||||
"""get"""
|
||||
|
||||
def get_details(db: Session, IDObject: str = None):
|
||||
return exec_procedure(db, 'uspGetPersonalAccountServices', {'IDObject': IDObject})
|
||||
print(IDObject)
|
||||
return exec_procedure(db, 'uspGetObjectDetails', {'IDObject': IDObject})
|
||||
|
||||
def get_municipals(db: Session, IDCity: int = None):
|
||||
return exec_procedure(db, 'uspGetObjectMunicipals', {'IDCity': IDCity})
|
||||
@ -254,7 +255,7 @@ class AccrualViewSet:
|
||||
"""get"""
|
||||
|
||||
def get_municipals(db: Session, data: schemas.AccountInit):
|
||||
return exec_procedure(db, 'uspCalculateAccrued', **data)
|
||||
return exec_procedure(db, 'uspCalculateAccrued', data.dict())
|
||||
|
||||
"""post"""
|
||||
|
||||
@ -295,7 +296,8 @@ class ReferenceViewSet:
|
||||
return db.query(tb).with_entities(tb.c["ID"]).all()
|
||||
|
||||
def get_objects(db: Session, data: schemas.CityInit):
|
||||
return exec_procedure(db, 'uspGetObjects', **data)
|
||||
|
||||
return exec_procedure(db, 'uspGetObjects', data.dict())
|
||||
|
||||
def get_services(db: Session):
|
||||
tb = get_table('uslugi', 'spr')
|
||||
@ -320,7 +322,7 @@ class ReferenceViewSet:
|
||||
return db.query(tb).all()
|
||||
|
||||
def get_provider_contracts(db: Session, data: schemas.PAInit):
|
||||
return exec_procedure(db, 'uspGetProviderContracts', **data)
|
||||
return exec_procedure(db, 'uspGetProviderContracts', data.dict())
|
||||
|
||||
def get_providers_utility_services(db: Session, data: schemas.CityInit):
|
||||
tb = get_table('RefProvidersUtilityServices', 'General')
|
||||
@ -369,6 +371,10 @@ class ReferenceViewSet:
|
||||
tb = get_table('RefObjectWiringTypes', 'General')
|
||||
return db.query(tb).with_entities(tb.c["ID"], tb.c["Name"]).all()
|
||||
|
||||
def get_object_overlapping_types(db: Session):
|
||||
tb = get_table('RefObjectOverlappingTypes', 'General')
|
||||
return db.query(tb).with_entities(tb.c["ID"], tb.c["Name"]).all()
|
||||
|
||||
def get_object_wall_material_types(db: Session):
|
||||
tb = get_table('RefObjectWallMaterialTypes', 'General')
|
||||
return db.query(tb).with_entities(tb.c["ID"], tb.c["Name"]).all()
|
||||
|
Reference in New Issue
Block a user