refactor(routers): comment out legacy endpoints across multiple routers
Disabled legacy routes that are superseded by V3 equivalents. Code is commented out (not deleted) pending final verification and cleanup pass. - registry.py: remove sql, lookup (/lu), websockets, websockets_redis; clean up dead imports (contact, event_person, etc.) - data_store.py: comment out legacy CRUD and code-lookup endpoints; keep V3 code-lookup routes active; add TODO for action path rename - api.py: comment out Api_Base CRUD, get_id (internal ID leak), and sql_test (debug) endpoints - aether_cfg.py: comment out legacy Flask cfg endpoint - user.py: comment out legacy user endpoints - util_email.py: minor cleanup Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,65 +20,67 @@ from app.models.user_models import User_Base, User_New_Base, User_Out_Base
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post('/user', response_model=Resp_Body_Base)
|
||||
async def post_user_obj(
|
||||
obj: User_Base,
|
||||
return_obj: Optional[bool] = True,
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# @router.post('/user', response_model=Resp_Body_Base)
|
||||
# async def post_user_obj(
|
||||
# obj: User_Base,
|
||||
# return_obj: Optional[bool] = True,
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
# ):
|
||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
obj_type = 'user'
|
||||
obj_data_dict = obj.dict(by_alias=False, exclude_unset=True)
|
||||
result = post_obj_template(
|
||||
obj_type = obj_type,
|
||||
data = obj_data_dict,
|
||||
return_obj = True,
|
||||
by_alias = True,
|
||||
exclude_unset = True,
|
||||
)
|
||||
return result
|
||||
# obj_type = 'user'
|
||||
# obj_data_dict = obj.dict(by_alias=False, exclude_unset=True)
|
||||
# result = post_obj_template(
|
||||
# obj_type = obj_type,
|
||||
# data = obj_data_dict,
|
||||
# return_obj = True,
|
||||
# by_alias = True,
|
||||
# exclude_unset = True,
|
||||
# )
|
||||
# return result
|
||||
|
||||
|
||||
# ### BEGIN ### API User ### post_user_obj_new() ###
|
||||
# Updated 2021-08-21 (complete re-write)
|
||||
@router.post('/user/new', response_model=Resp_Body_Base)
|
||||
async def post_user_obj_new(
|
||||
user_obj: User_New_Base,
|
||||
allow_update: bool = False,
|
||||
avoid_dup_username: bool = False,
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# # ### BEGIN ### API User ### post_user_obj_new() ###
|
||||
# # Updated 2021-08-21 (complete re-write)
|
||||
# @router.post('/user/new', response_model=Resp_Body_Base)
|
||||
# async def post_user_obj_new(
|
||||
# user_obj: User_New_Base,
|
||||
# allow_update: bool = False,
|
||||
# avoid_dup_username: bool = False,
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
# ):
|
||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
if account_id_random := user_obj.account_id_random: pass
|
||||
else: return False
|
||||
# if account_id_random := user_obj.account_id_random: pass
|
||||
# else: return False
|
||||
|
||||
if create_user_obj_result := create_user_obj(account_id=account_id_random, user_dict_obj=user_obj, allow_update=allow_update, avoid_dup_username=avoid_dup_username): pass
|
||||
else: return mk_resp(data=False, status_code=400, response=commons.response, status_message='The user account was not created. This is likely because that username already exists for this account.')
|
||||
# if create_user_obj_result := create_user_obj(account_id=account_id_random, user_dict_obj=user_obj, allow_update=allow_update, avoid_dup_username=avoid_dup_username): pass
|
||||
# else: return mk_resp(data=False, status_code=400, response=commons.response, status_message='The user account was not created. This is likely because that username already exists for this account.')
|
||||
|
||||
if isinstance(create_user_obj_result, int):
|
||||
user_id = create_user_obj_result
|
||||
if return_obj:
|
||||
if load_user_obj_result := load_user_obj(user_id=user_id):
|
||||
data = load_user_obj_result
|
||||
else:
|
||||
data = False
|
||||
else:
|
||||
user_id = create_user_obj_result
|
||||
user_id_random = get_id_random(record_id=user_id, table_name='user')
|
||||
data = {}
|
||||
data['user_id'] = user_id
|
||||
data['user_id_random'] = user_id_random
|
||||
return mk_resp(data=data, response=commons.response, status_message='The user account was created.')
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400, response=commons.response, status_message='The result from trying to create a user account was unexpected.')
|
||||
# ### END ### API User ### post_user_obj_new() ###
|
||||
# if isinstance(create_user_obj_result, int):
|
||||
# user_id = create_user_obj_result
|
||||
# if return_obj:
|
||||
# if load_user_obj_result := load_user_obj(user_id=user_id):
|
||||
# data = load_user_obj_result
|
||||
# else:
|
||||
# data = False
|
||||
# else:
|
||||
# user_id = create_user_obj_result
|
||||
# user_id_random = get_id_random(record_id=user_id, table_name='user')
|
||||
# data = {}
|
||||
# data['user_id'] = user_id
|
||||
# data['user_id_random'] = user_id_random
|
||||
# return mk_resp(data=data, response=commons.response, status_message='The user account was created.')
|
||||
# else:
|
||||
# return mk_resp(data=False, status_code=400, response=commons.response, status_message='The result from trying to create a user account was unexpected.')
|
||||
# # ### END ### API User ### post_user_obj_new() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API User ### user_obj_change_password() ###
|
||||
# NOTE: This is actively in use 2026-03-24 -Scott
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!
|
||||
@router.patch('/user/{user_id}/change_password', response_model=Resp_Body_Base)
|
||||
async def user_obj_change_password(
|
||||
user_id: Union[int,str],
|
||||
@@ -143,35 +145,37 @@ async def user_obj_change_password(
|
||||
# ### END ### API User ### user_obj_change_password() ###
|
||||
|
||||
|
||||
@router.patch('/user/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_user_obj(
|
||||
obj: User_Base,
|
||||
obj_id: str = Path(min_length=11, max_length=22),
|
||||
return_obj: Optional[bool] = True,
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# @router.patch('/user/{obj_id}', response_model=Resp_Body_Base)
|
||||
# async def patch_user_obj(
|
||||
# obj: User_Base,
|
||||
# obj_id: str = Path(min_length=11, max_length=22),
|
||||
# return_obj: Optional[bool] = True,
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
# ):
|
||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
obj_type = 'user'
|
||||
obj_data_dict = obj.dict(by_alias=False, exclude_unset=True)
|
||||
obj_data_dict['id'] = redis_lookup_id_random(record_id_random=obj_id, table_name=obj_type)
|
||||
obj_data_dict['id_random'] = obj_id
|
||||
result = patch_obj_template(
|
||||
obj_type=obj_type,
|
||||
data=obj_data_dict,
|
||||
obj_id=obj_id,
|
||||
return_obj=True,
|
||||
by_alias=True,
|
||||
exclude_unset=True,
|
||||
)
|
||||
return result
|
||||
# obj_type = 'user'
|
||||
# obj_data_dict = obj.dict(by_alias=False, exclude_unset=True)
|
||||
# obj_data_dict['id'] = redis_lookup_id_random(record_id_random=obj_id, table_name=obj_type)
|
||||
# obj_data_dict['id_random'] = obj_id
|
||||
# result = patch_obj_template(
|
||||
# obj_type=obj_type,
|
||||
# data=obj_data_dict,
|
||||
# obj_id=obj_id,
|
||||
# return_obj=True,
|
||||
# by_alias=True,
|
||||
# exclude_unset=True,
|
||||
# )
|
||||
# return result
|
||||
|
||||
|
||||
# ### BEGIN ### API User Routers ### user_new_auth_key() ###
|
||||
# Generate a new one time use authorization key for login without password
|
||||
# Updated 2022-01-07
|
||||
# @router.get('/user/new_auth_key', response_model=Resp_Body_Base)
|
||||
# NOTE: This is actively in use 2026-03-24
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!
|
||||
@router.get('/user/{user_id}/new_auth_key', response_model=Resp_Body_Base)
|
||||
async def user_new_auth_key(
|
||||
user_id: str = Path(min_length=11, max_length=22),
|
||||
@@ -218,7 +222,8 @@ async def user_new_auth_key(
|
||||
# A new key will need to be requested for a particular user each time.
|
||||
# NOTE: Should this be divided into username/password and user ID/auth key endpoints? Probably vote 2x
|
||||
# Updated 2021-10-06
|
||||
@router.get('/user/authenticate', response_model=Resp_Body_Base)
|
||||
# NOTE: This is actively in use 2026-03-24 -Scott
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!@router.get('/user/authenticate', response_model=Resp_Body_Base)
|
||||
async def user_authenticate(
|
||||
null_account_id: bool = False,
|
||||
user_id: Optional[str] = Query(None, min_length=11, max_length=22),
|
||||
@@ -394,6 +399,8 @@ async def user_authenticate(
|
||||
|
||||
|
||||
# ### BEGIN ### API User ### user_verify_password() ###
|
||||
# NOTE: This may be actively in use 2026-03-24
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!
|
||||
# @router.post('/{user_id}/verify_password', response_model=Resp_Body_Base)
|
||||
@router.post('/user/verify_password', response_model=Resp_Body_Base)
|
||||
async def user_verify_password(
|
||||
@@ -487,82 +494,84 @@ async def user_verify_password(
|
||||
# ### END ### API User ### user_verify_password() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API User ### get_account_user_obj_li() ###
|
||||
# Updated 2021-12-13
|
||||
@router.get('/account/{account_id}/user/list', response_model=Resp_Body_Base)
|
||||
async def get_account_user_obj_li(
|
||||
account_id: str = Path(min_length=11, max_length=22),
|
||||
hidden: str = 'not_hidden', # hidden, not_hidden, all
|
||||
inc_address: bool = False, # Priority l1
|
||||
inc_contact: bool = False, # Priority l1
|
||||
inc_person: bool = False, # Priority l1
|
||||
inc_user_role_list: bool = False, # Priority l1
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# # ### BEGIN ### API User ### get_account_user_obj_li() ###
|
||||
# # Updated 2021-12-13
|
||||
# @router.get('/account/{account_id}/user/list', response_model=Resp_Body_Base)
|
||||
# async def get_account_user_obj_li(
|
||||
# account_id: str = Path(min_length=11, max_length=22),
|
||||
# hidden: str = 'not_hidden', # hidden, not_hidden, all
|
||||
# inc_address: bool = False, # Priority l1
|
||||
# inc_contact: bool = False, # Priority l1
|
||||
# inc_person: bool = False, # Priority l1
|
||||
# inc_user_role_list: bool = False, # Priority l1
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
# ):
|
||||
# log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# 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, response=commons.response)
|
||||
# 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, response=commons.response)
|
||||
|
||||
# Updated 2021-12-13
|
||||
if user_rec_list_result := get_user_rec_list(
|
||||
account_id = account_id,
|
||||
hidden = hidden, # hidden, not_hidden, all
|
||||
enabled = commons.enabled,
|
||||
limit = commons.limit,
|
||||
):
|
||||
user_result_list = []
|
||||
for user_rec in user_rec_list_result:
|
||||
if load_user_result := load_user_obj(
|
||||
user_id = user_rec.get('user_id', None),
|
||||
enabled = commons.enabled,
|
||||
# hidden = hidden,
|
||||
limit = commons.limit,
|
||||
inc_address = inc_address,
|
||||
inc_contact = inc_contact,
|
||||
inc_person = inc_person,
|
||||
inc_user_role_list = inc_user_role_list,
|
||||
by_alias = commons.by_alias,
|
||||
exclude_unset = commons.exclude_unset,
|
||||
# model_as_dict = model_as_dict,
|
||||
):
|
||||
user_result_list.append(load_user_result)
|
||||
else:
|
||||
user_result_list.append(None)
|
||||
response_data = user_result_list
|
||||
elif isinstance(user_rec_list_result, list) or user_rec_list_result is None: # Empty list or None
|
||||
log.info('No results')
|
||||
return mk_resp(data=False, status_code=404, response=commons.response) # Not Found
|
||||
else:
|
||||
log.warning('Likely bad request')
|
||||
return mk_resp(data=False, status_code=400, response=commons.response) # Bad Request
|
||||
# # Updated 2021-12-13
|
||||
# if user_rec_list_result := get_user_rec_list(
|
||||
# account_id = account_id,
|
||||
# hidden = hidden, # hidden, not_hidden, all
|
||||
# enabled = commons.enabled,
|
||||
# limit = commons.limit,
|
||||
# ):
|
||||
# user_result_list = []
|
||||
# for user_rec in user_rec_list_result:
|
||||
# if load_user_result := load_user_obj(
|
||||
# user_id = user_rec.get('user_id', None),
|
||||
# enabled = commons.enabled,
|
||||
# # hidden = hidden,
|
||||
# limit = commons.limit,
|
||||
# inc_address = inc_address,
|
||||
# inc_contact = inc_contact,
|
||||
# inc_person = inc_person,
|
||||
# inc_user_role_list = inc_user_role_list,
|
||||
# by_alias = commons.by_alias,
|
||||
# exclude_unset = commons.exclude_unset,
|
||||
# # model_as_dict = model_as_dict,
|
||||
# ):
|
||||
# user_result_list.append(load_user_result)
|
||||
# else:
|
||||
# user_result_list.append(None)
|
||||
# response_data = user_result_list
|
||||
# elif isinstance(user_rec_list_result, list) or user_rec_list_result is None: # Empty list or None
|
||||
# log.info('No results')
|
||||
# return mk_resp(data=False, status_code=404, response=commons.response) # Not Found
|
||||
# else:
|
||||
# log.warning('Likely bad request')
|
||||
# return mk_resp(data=False, status_code=400, response=commons.response) # Bad Request
|
||||
|
||||
return mk_resp(data=response_data, response=commons.response)
|
||||
# ### END ### API User ### get_account_user_obj_li() ###
|
||||
# return mk_resp(data=response_data, response=commons.response)
|
||||
# # ### END ### API User ### get_account_user_obj_li() ###
|
||||
|
||||
|
||||
@router.get('/user/list', response_model=Resp_Body_Base)
|
||||
async def get_user_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),
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# @router.get('/user/list', response_model=Resp_Body_Base)
|
||||
# async def get_user_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),
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
# ):
|
||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
obj_type = 'user'
|
||||
result = get_obj_li_template(
|
||||
obj_type=obj_type,
|
||||
for_obj_type=for_obj_type,
|
||||
for_obj_id=for_obj_id,
|
||||
by_alias=True,
|
||||
exclude_unset=True,
|
||||
)
|
||||
return result
|
||||
# obj_type = 'user'
|
||||
# result = get_obj_li_template(
|
||||
# obj_type=obj_type,
|
||||
# for_obj_type=for_obj_type,
|
||||
# for_obj_id=for_obj_id,
|
||||
# by_alias=True,
|
||||
# exclude_unset=True,
|
||||
# )
|
||||
# return result
|
||||
|
||||
|
||||
# Look up is only for account or person records
|
||||
# NOTE: This may be actively in use 2026-03-24
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!
|
||||
@router.get('/user/lookup', response_model=Resp_Body_Base)
|
||||
async def lookup_user_obj(
|
||||
for_obj_id: Union[int,str],
|
||||
@@ -638,6 +647,8 @@ async def lookup_user_obj(
|
||||
|
||||
|
||||
# Look up a user with an email address for an account
|
||||
# NOTE: This may be actively in use 2026-03-24 -Scott
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!
|
||||
@router.get('/user/lookup_email', response_model=Resp_Body_Base)
|
||||
async def lookup_email(
|
||||
email: str = Query(..., min_length=2, max_length=50),
|
||||
@@ -728,6 +739,8 @@ async def lookup_email(
|
||||
|
||||
# Look up is only for account or person records
|
||||
# Look up a user with a username for an account
|
||||
# NOTE: This may be actively in use 2026-03-24
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!
|
||||
@router.get('/user/lookup_username', response_model=Resp_Body_Base)
|
||||
async def lookup_username(
|
||||
username: str = Query(..., min_length=2, max_length=50),
|
||||
@@ -799,6 +812,8 @@ async def lookup_username(
|
||||
# This requires the user_id and root_url or base_url.
|
||||
# This endpoint will generate a new user auth_key and send the email to the user's email address.
|
||||
# Updated 2025-04-08
|
||||
# NOTE: This is actively in use 2026-03-24 -Scott
|
||||
# This is marked for deprecation and must be migrated to Aether API v3 standards!
|
||||
# @router.get('/user/email_auth_key_url', response_model=Resp_Body_Base)
|
||||
@router.get('/user/{user_id}/email_auth_key_url', response_model=Resp_Body_Base)
|
||||
async def email_auth_key_url(
|
||||
@@ -830,69 +845,69 @@ async def email_auth_key_url(
|
||||
# ### END ### API User ### email_auth_key_url() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API User ### get_user_obj() ###
|
||||
# Updated 2022-01-05
|
||||
@router.get('/user/{user_id}', response_model=Resp_Body_Base)
|
||||
async def get_user_obj(
|
||||
user_id: str = Path(min_length=11, max_length=22),
|
||||
inc_address: bool = False, # Priority l1
|
||||
# inc_archive_list: bool = False, # Priority l3
|
||||
inc_contact: bool = False, # Priority l1
|
||||
inc_event_list: bool = False, # Priority l1
|
||||
# inc_hosted_file_list: bool = False, # Priority l3
|
||||
inc_journal_list: bool = False, # Priority l2
|
||||
# inc_journal_entry_list: bool = False, # Priority l3
|
||||
inc_membership_person: bool = False, # Priority l2
|
||||
# inc_membership_list: bool = False, # ???
|
||||
inc_order_line_list: bool = False, # Priority l1
|
||||
inc_order_list: bool = False, # Priority l1
|
||||
inc_order_cart_list: bool = False, # Priority l1
|
||||
inc_organization: bool = False, # Priority l1
|
||||
# inc_organization_list: bool = False,
|
||||
inc_person: bool = False, # Priority l1
|
||||
# inc_person_list: bool = False,
|
||||
inc_post_list: bool = False, # Priority l2
|
||||
inc_post_comment_list: bool = False, # Priority l3
|
||||
inc_user_role_list: bool = False, # Priority l1
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# # ### BEGIN ### API User ### get_user_obj() ###
|
||||
# # Updated 2022-01-05
|
||||
# @router.get('/user/{user_id}', response_model=Resp_Body_Base)
|
||||
# async def get_user_obj(
|
||||
# user_id: str = Path(min_length=11, max_length=22),
|
||||
# inc_address: bool = False, # Priority l1
|
||||
# # inc_archive_list: bool = False, # Priority l3
|
||||
# inc_contact: bool = False, # Priority l1
|
||||
# inc_event_list: bool = False, # Priority l1
|
||||
# # inc_hosted_file_list: bool = False, # Priority l3
|
||||
# inc_journal_list: bool = False, # Priority l2
|
||||
# # inc_journal_entry_list: bool = False, # Priority l3
|
||||
# inc_membership_person: bool = False, # Priority l2
|
||||
# # inc_membership_list: bool = False, # ???
|
||||
# inc_order_line_list: bool = False, # Priority l1
|
||||
# inc_order_list: bool = False, # Priority l1
|
||||
# inc_order_cart_list: bool = False, # Priority l1
|
||||
# inc_organization: bool = False, # Priority l1
|
||||
# # inc_organization_list: bool = False,
|
||||
# inc_person: bool = False, # Priority l1
|
||||
# # inc_person_list: bool = False,
|
||||
# inc_post_list: bool = False, # Priority l2
|
||||
# inc_post_comment_list: bool = False, # Priority l3
|
||||
# inc_user_role_list: bool = False, # Priority l1
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
# ):
|
||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
if user_id := redis_lookup_id_random(record_id_random=user_id, table_name='user'): pass
|
||||
else: return mk_resp(data=None, status_code=404, response=commons.response)
|
||||
# if user_id := redis_lookup_id_random(record_id_random=user_id, table_name='user'): pass
|
||||
# else: return mk_resp(data=None, status_code=404, response=commons.response)
|
||||
|
||||
if user_result := load_user_obj(
|
||||
user_id = user_id,
|
||||
limit = commons.limit,
|
||||
model_as_dict = True, # NOTE: returning model as a dict
|
||||
enabled = commons.enabled,
|
||||
inc_address = inc_address,
|
||||
# inc_archive_list = inc_archive_list,
|
||||
inc_contact = inc_contact,
|
||||
inc_event_list = inc_event_list,
|
||||
# inc_hosted_file_list = inc_hosted_file_list,
|
||||
# inc_journal_list = inc_journal_list,
|
||||
# inc_journal_entry_list = inc_journal_entry_list,
|
||||
# inc_membership_person = inc_membership_person,
|
||||
# inc_membership_list = inc_membership_list, # ???
|
||||
inc_order_line_list = inc_order_line_list,
|
||||
inc_order_list = inc_order_list,
|
||||
inc_order_cart_list = inc_order_cart_list,
|
||||
# inc_organization = inc_organization,
|
||||
# inc_organization_list = inc_organization_list,
|
||||
inc_person = inc_person,
|
||||
# inc_person_list = inc_person_list,
|
||||
# inc_post_list = inc_post_list,
|
||||
# inc_post_comment_list = inc_post_comment_list,
|
||||
inc_user_role_list = inc_user_role_list,
|
||||
):
|
||||
response_data = user_result
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400, response=commons.response) # Bad Request
|
||||
# if user_result := load_user_obj(
|
||||
# user_id = user_id,
|
||||
# limit = commons.limit,
|
||||
# model_as_dict = True, # NOTE: returning model as a dict
|
||||
# enabled = commons.enabled,
|
||||
# inc_address = inc_address,
|
||||
# # inc_archive_list = inc_archive_list,
|
||||
# inc_contact = inc_contact,
|
||||
# inc_event_list = inc_event_list,
|
||||
# # inc_hosted_file_list = inc_hosted_file_list,
|
||||
# # inc_journal_list = inc_journal_list,
|
||||
# # inc_journal_entry_list = inc_journal_entry_list,
|
||||
# # inc_membership_person = inc_membership_person,
|
||||
# # inc_membership_list = inc_membership_list, # ???
|
||||
# inc_order_line_list = inc_order_line_list,
|
||||
# inc_order_list = inc_order_list,
|
||||
# inc_order_cart_list = inc_order_cart_list,
|
||||
# # inc_organization = inc_organization,
|
||||
# # inc_organization_list = inc_organization_list,
|
||||
# inc_person = inc_person,
|
||||
# # inc_person_list = inc_person_list,
|
||||
# # inc_post_list = inc_post_list,
|
||||
# # inc_post_comment_list = inc_post_comment_list,
|
||||
# inc_user_role_list = inc_user_role_list,
|
||||
# ):
|
||||
# response_data = user_result
|
||||
# else:
|
||||
# return mk_resp(data=False, status_code=400, response=commons.response) # Bad Request
|
||||
|
||||
return mk_resp(data=response_data, response=commons.response)
|
||||
# ### END ### API User ### get_user_obj() ###
|
||||
# return mk_resp(data=response_data, response=commons.response)
|
||||
# # ### END ### API User ### get_user_obj() ###
|
||||
|
||||
|
||||
# # ### BEGIN ### API User ### get_user_obj_order_list() ###
|
||||
@@ -962,17 +977,17 @@ async def get_user_obj(
|
||||
# # ### END ### API User ### get_user_obj_order_list() ###
|
||||
|
||||
|
||||
@router.delete('/user/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def delete_user_obj(
|
||||
obj_id: str = Path(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())
|
||||
# @router.delete('/user/{obj_id}', response_model=Resp_Body_Base)
|
||||
# async def delete_user_obj(
|
||||
# obj_id: str = Path(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())
|
||||
|
||||
obj_type = 'user'
|
||||
result = delete_obj_template(
|
||||
obj_type=obj_type,
|
||||
obj_id=obj_id,
|
||||
)
|
||||
return result
|
||||
# obj_type = 'user'
|
||||
# result = delete_obj_template(
|
||||
# obj_type=obj_type,
|
||||
# obj_id=obj_id,
|
||||
# )
|
||||
# return result
|
||||
Reference in New Issue
Block a user