Work on things
This commit is contained in:
@@ -149,7 +149,7 @@ async def get_account_obj_li(
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400, response=response) # Bad Request
|
||||
|
||||
return mk_resp(data=response_data)
|
||||
return mk_resp(data=response_data, response=response)
|
||||
|
||||
|
||||
# ### BEGIN ### API Account ### get_account_obj_new() ###
|
||||
@@ -238,7 +238,7 @@ async def get_account_obj_new(
|
||||
log.debug(locals())
|
||||
|
||||
if account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): pass
|
||||
else: return mk_resp(data=None, status_code=404)
|
||||
else: return mk_resp(data=None, status_code=404, response=response)
|
||||
|
||||
if account_result := load_account_obj(
|
||||
account_id = account_id,
|
||||
@@ -329,7 +329,7 @@ async def get_account_obj_new(
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400, response=response) # Bad Request
|
||||
|
||||
return mk_resp(data=response_data)
|
||||
return mk_resp(data=response_data, response=response)
|
||||
# ### END ### API Account ### get_account_obj_new() ###
|
||||
|
||||
|
||||
@@ -352,29 +352,40 @@ async def delete_account_obj(
|
||||
|
||||
@router.get('/{account_id}/cfg', response_model=Resp_Body_Base)
|
||||
async def get_account_cfg_obj(
|
||||
account_id: str = Query(..., min_length=1, max_length=22),
|
||||
account_id: str = Query(..., min_length=11, max_length=22),
|
||||
sys_module: Optional[str] = None, # event, fundraising, membership
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
# print(x_account_id)
|
||||
|
||||
if account_id := redis_lookup_id_random(record_id_random=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=response)
|
||||
|
||||
if sys_module:
|
||||
if sys_module == 'membership':
|
||||
membership_cfg_obj = load_account_cfg_obj(account_id=account_id, inc_membership_cfg=True).dict(by_alias=by_alias, exclude_unset=exclude_unset)
|
||||
data = membership_cfg_obj
|
||||
return mk_resp(data=data)
|
||||
return mk_resp(data=data, response=response)
|
||||
else:
|
||||
obj_type = 'account_cfg'
|
||||
result = get_obj_template(
|
||||
obj_type=obj_type,
|
||||
obj_id=account_id,
|
||||
by_alias=True,
|
||||
exclude_unset=True,
|
||||
)
|
||||
#log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(result)
|
||||
return result
|
||||
if account_cfg_obj := load_account_cfg_obj(account_id=account_id).dict(by_alias=by_alias, exclude_unset=exclude_unset):
|
||||
data = account_cfg_obj
|
||||
return mk_resp(data=data, response=response)
|
||||
else:
|
||||
return mk_resp(data=False, status_code=404, response=response)
|
||||
|
||||
# obj_type = 'account_cfg'
|
||||
# result = get_obj_template(
|
||||
# obj_type=obj_type,
|
||||
# obj_id=account_id,
|
||||
# by_alias=True,
|
||||
# exclude_unset=True,
|
||||
# )
|
||||
# #log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(result)
|
||||
# return result
|
||||
|
||||
Reference in New Issue
Block a user