Moving things to use the common_route_params
This commit is contained in:
@@ -27,11 +27,10 @@ router = APIRouter()
|
||||
@router.post('', response_model=Resp_Body_Base)
|
||||
async def post_account_obj(
|
||||
obj: Account_Base,
|
||||
x_account_id: str = Header(...),
|
||||
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -51,12 +50,11 @@ async def post_account_obj(
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_account_obj(
|
||||
obj: Account_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -98,7 +96,6 @@ async def get_account_obj_li(
|
||||
inc_site_list: bool = False,
|
||||
inc_site_domain_list: bool = False,
|
||||
inc_user_list: bool = False,
|
||||
return_obj: bool = True,
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
@@ -152,7 +149,7 @@ async def get_account_obj_li(
|
||||
# Working well as of 2021-06-11. Using as a template for other routes.
|
||||
@router.get('/{account_id}', response_model=Resp_Body_Base)
|
||||
async def get_account_obj_new(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Query(..., min_length=11, max_length=22),
|
||||
inc_account_cfg: bool = False, # Priority l1
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_address_list: bool = False,
|
||||
@@ -327,9 +324,8 @@ async def get_account_obj_new(
|
||||
|
||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def delete_account_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
response: Response = Response,
|
||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -352,9 +348,9 @@ async def get_account_cfg_obj(
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
# print(x_account_id)
|
||||
# print(commons.x_account_id)
|
||||
|
||||
if account_id := redis_lookup_id_random(record_id_random=x_account_id, table_name='account'): pass
|
||||
if account_id := redis_lookup_id_random(record_id_random=commons.x_account_id, table_name='account'): pass
|
||||
else: return mk_resp(data=None, status_code=404, status_message=f'The Account ID was not found. Account ID: {account_id}', response=commons.response)
|
||||
|
||||
if sys_module:
|
||||
|
||||
@@ -357,7 +357,8 @@ async def patch_person_obj(
|
||||
@router.get('/person/list', response_model=Resp_Body_Base)
|
||||
async def get_person_obj_li(
|
||||
for_obj_type: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
for_obj_id: Optional[str] = Query(None, min_length=1, max_length=22),
|
||||
for_obj_id: Optional[str] = Query(None, min_length=11, max_length=22),
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
|
||||
Reference in New Issue
Block a user