Code clean up
This commit is contained in:
@@ -24,7 +24,7 @@ from app.models.response_models import Resp_Body_Base, mk_resp
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post('', response_model=Resp_Body_Base)
|
@router.post('/account', response_model=Resp_Body_Base)
|
||||||
async def post_account_obj(
|
async def post_account_obj(
|
||||||
obj: Account_Base,
|
obj: Account_Base,
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ async def post_account_obj(
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
@router.patch('/account/{obj_id}', response_model=Resp_Body_Base)
|
||||||
async def patch_account_obj(
|
async def patch_account_obj(
|
||||||
obj: Account_Base,
|
obj: Account_Base,
|
||||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||||
@@ -76,7 +76,7 @@ async def patch_account_obj(
|
|||||||
|
|
||||||
# ### BEGIN ### API Account ### get_account_obj_li() ###
|
# ### BEGIN ### API Account ### get_account_obj_li() ###
|
||||||
# Updated 2021-09-28
|
# Updated 2021-09-28
|
||||||
@router.get('/list', response_model=Resp_Body_Base)
|
@router.get('/account/list', response_model=Resp_Body_Base)
|
||||||
async def get_account_obj_li(
|
async def get_account_obj_li(
|
||||||
# inc_address: bool = False,
|
# inc_address: bool = False,
|
||||||
# inc_address_list: bool = False,
|
# inc_address_list: bool = False,
|
||||||
@@ -145,10 +145,10 @@ async def get_account_obj_li(
|
|||||||
return mk_resp(data=response_data, response=commons.response)
|
return mk_resp(data=response_data, response=commons.response)
|
||||||
|
|
||||||
|
|
||||||
# ### BEGIN ### API Account ### get_account_obj_new() ###
|
# ### BEGIN ### API Account ### get_account_obj() ###
|
||||||
# Working well as of 2021-06-11. Using as a template for other routes.
|
# Working well as of 2021-06-11. Using as a template for other routes.
|
||||||
@router.get('/{account_id}', response_model=Resp_Body_Base)
|
@router.get('/account/{account_id}', response_model=Resp_Body_Base)
|
||||||
async def get_account_obj_new(
|
async def get_account_obj(
|
||||||
account_id: str = Query(..., min_length=11, max_length=22),
|
account_id: str = Query(..., min_length=11, max_length=22),
|
||||||
inc_account_cfg: bool = False, # Priority l1
|
inc_account_cfg: bool = False, # Priority l1
|
||||||
inc_address: bool = False, # Under contact
|
inc_address: bool = False, # Under contact
|
||||||
@@ -319,10 +319,10 @@ async def get_account_obj_new(
|
|||||||
return mk_resp(data=False, status_code=400, response=commons.response) # Bad Request
|
return mk_resp(data=False, status_code=400, response=commons.response) # Bad Request
|
||||||
|
|
||||||
return mk_resp(data=response_data, response=commons.response)
|
return mk_resp(data=response_data, response=commons.response)
|
||||||
# ### END ### API Account ### get_account_obj_new() ###
|
# ### END ### API Account ### get_account_obj() ###
|
||||||
|
|
||||||
|
|
||||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
@router.delete('/account/{obj_id}', response_model=Resp_Body_Base)
|
||||||
async def delete_account_obj(
|
async def delete_account_obj(
|
||||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||||
commons: Common_Route_Params = Depends(common_route_params),
|
commons: Common_Route_Params = Depends(common_route_params),
|
||||||
@@ -338,7 +338,7 @@ async def delete_account_obj(
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{account_id}/cfg', response_model=Resp_Body_Base)
|
@router.get('/account/{account_id}/cfg', response_model=Resp_Body_Base)
|
||||||
async def get_account_cfg_obj(
|
async def get_account_cfg_obj(
|
||||||
account_id: str = Query(..., min_length=11, max_length=22),
|
account_id: str = Query(..., min_length=11, max_length=22),
|
||||||
sys_module: Optional[str] = None, # event, fundraising, membership
|
sys_module: Optional[str] = None, # event, fundraising, membership
|
||||||
@@ -348,8 +348,6 @@ async def get_account_cfg_obj(
|
|||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
# print(commons.x_account_id)
|
|
||||||
|
|
||||||
if account_id := redis_lookup_id_random(record_id_random=commons.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)
|
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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user