Clean up some of the models and debug

This commit is contained in:
Scott Idem
2021-03-08 18:22:12 -05:00
parent 4f4cd0c985
commit 8a47572677
4 changed files with 10 additions and 12 deletions

View File

@@ -29,7 +29,7 @@ class Address_Base(BaseModel):
account_id: Optional[int]
for_type: Optional[str]
for_id_random: Optional[str]
for_id_random: Optional[str] = None
for_id: Optional[int]
#organization: Optional[Organization_Base] = Organization_Base()

View File

@@ -62,7 +62,7 @@ base_fields['obj_id'] = {}
base_fields['obj_name'] = {}
base_fields['obj_notes'] = {}
base_fields['for_id_random'] = xxx_id_random_field_schema_default
base_fields['for_id_random'] = xxx_id_random_field_schema_default # NOTE: This field may need to be set = None in the actual models with this field.
#xxx_id_random_field_schema['alias'] = 'order_id_random'
#base_fields['id_random'] = xxx_id_random_field_schema_default

View File

@@ -29,7 +29,7 @@ class User_Role_Base(BaseModel):
role_id: Optional[int]
for_type: Optional[str]
for_id_random: Optional[str]
for_id_random: Optional[str] = None
for_id: Optional[int]
enable: Optional[bool]

View File

@@ -9,7 +9,7 @@ from ..log import *
from app.config import settings
from app.db_sql import *
from ..models.address_model import *
from ..models.address_model import Address_Base
from ..models.response_model import *
@@ -20,13 +20,12 @@ router = APIRouter()
@router.post('')
async def post_address_obj(
address: Address_Base,
x_account_id: str = Header(...),
return_obj: Optional[bool] = True,
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
):
async def post_address_obj(address: Address_Base,
x_account_id: str = Header(...),
return_obj: Optional[bool] = True,
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
):
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
@@ -53,4 +52,3 @@ async def post_address_obj(
resp_data = base_name(**sql_select_result).dict(by_alias=by_alias, exclude_unset=exclude_unset)
return mk_resp(data=resp_data)