Working on membership, person, user, and order and general clean up.
This commit is contained in:
@@ -291,6 +291,21 @@ def get_order_rec_list(
|
||||
# data['for_obj_type'] = for_obj_type
|
||||
sql_obj_type_id = f'`tbl`.{for_obj_type}_id = :{for_obj_type}_id'
|
||||
|
||||
allowed_status_li = ['started', 'in progress', 'complete', 'all']
|
||||
sql_status = ''
|
||||
if status in allowed_status_li:
|
||||
if status == 'status':
|
||||
data['status'] = True
|
||||
sql_status = f'AND `tbl`.status = :status'
|
||||
elif status == 'disabled':
|
||||
data['status'] = False
|
||||
sql_status = f'AND `tbl`.status = :status'
|
||||
elif status == 'all':
|
||||
sql_status = ''
|
||||
else:
|
||||
log.warning('The status value passed is not allowed. Returning None')
|
||||
return None
|
||||
|
||||
# if enabled in ['enabled', 'disabled', 'all']:
|
||||
# if enabled == 'enabled':
|
||||
# data['enable'] = True
|
||||
@@ -313,6 +328,7 @@ def get_order_rec_list(
|
||||
FROM `order` AS `tbl`
|
||||
WHERE
|
||||
{sql_obj_type_id}
|
||||
{sql_status}
|
||||
{sql_enabled}
|
||||
ORDER BY `tbl`.created_on DESC, `tbl`.updated_on DESC
|
||||
{sql_limit};
|
||||
|
||||
@@ -84,7 +84,7 @@ async def change_user_obj_password(
|
||||
password: Optional[str] = Query(None, min_length=6, max_length=50),
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: bool = False,
|
||||
inc_roles: bool = False,
|
||||
inc_user_role_list: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_organization: bool = False,
|
||||
inc_person: bool = False,
|
||||
@@ -202,7 +202,7 @@ async def user_authenticate(
|
||||
password: Optional[str] = Query(None, min_length=6, max_length=50),
|
||||
auth_key: Optional[str] = Query(None, min_length=11, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
inc_roles: bool = False,
|
||||
inc_user_role_list: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_organization: bool = False,
|
||||
inc_person: bool = False,
|
||||
@@ -296,7 +296,7 @@ async def user_authenticate(
|
||||
|
||||
user_obj = load_user_obj(
|
||||
user_id=user_id,
|
||||
inc_roles=inc_roles,
|
||||
inc_user_role_list=inc_user_role_list,
|
||||
inc_contact=inc_contact,
|
||||
inc_organization=inc_organization,
|
||||
inc_person=inc_person
|
||||
@@ -337,7 +337,7 @@ async def lookup_user_obj(
|
||||
for_obj_id: Union[int,str],
|
||||
for_obj_type: str = Query(..., min_length=2, max_length=50),
|
||||
x_account_id: str = Header(...),
|
||||
inc_roles: bool = False,
|
||||
inc_user_role_list: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_organization: bool = False,
|
||||
inc_person: bool = False,
|
||||
@@ -382,7 +382,7 @@ async def lookup_user_obj(
|
||||
user_id = user_rec_result.get('user_id', None)
|
||||
user_obj = load_user_obj(
|
||||
user_id=user_id,
|
||||
inc_roles=inc_roles,
|
||||
inc_user_role_list=inc_user_role_list,
|
||||
inc_contact=inc_contact,
|
||||
inc_organization=inc_organization,
|
||||
inc_person=inc_person
|
||||
@@ -395,7 +395,7 @@ async def lookup_user_obj(
|
||||
user_obj_li.append(
|
||||
load_user_obj(
|
||||
user_id=user_id,
|
||||
inc_roles=inc_roles,
|
||||
inc_user_role_list=inc_user_role_list,
|
||||
inc_contact=inc_contact,
|
||||
inc_organization=inc_organization,
|
||||
inc_person=inc_person,
|
||||
@@ -414,7 +414,7 @@ async def lookup_email(
|
||||
account_id: Union[int,str],
|
||||
email: str = Query(..., min_length=2, max_length=50),
|
||||
x_account_id: str = Header(...),
|
||||
inc_roles: bool = False,
|
||||
inc_user_role_list: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_organization: bool = False,
|
||||
inc_person: bool = False,
|
||||
@@ -457,7 +457,7 @@ async def lookup_email(
|
||||
user_id = user_obj_result.get('user_id', None)
|
||||
user_obj = load_user_obj(
|
||||
user_id=user_id,
|
||||
inc_roles=inc_roles,
|
||||
inc_user_role_list=inc_user_role_list,
|
||||
inc_contact=inc_contact,
|
||||
inc_organization=inc_organization,
|
||||
inc_person=inc_person
|
||||
@@ -470,7 +470,7 @@ async def lookup_email(
|
||||
user_obj_li.append(
|
||||
load_user_obj(
|
||||
user_id=user_id,
|
||||
inc_roles=inc_roles,
|
||||
inc_user_role_list=inc_user_role_list,
|
||||
inc_contact=inc_contact,
|
||||
inc_organization=inc_organization,
|
||||
inc_person=inc_person,
|
||||
@@ -490,10 +490,11 @@ async def lookup_username(
|
||||
account_id: Union[int,str],
|
||||
username: str = Query(..., min_length=2, max_length=50),
|
||||
x_account_id: str = Header(...),
|
||||
inc_user_role_list: bool = False,
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_organization: bool = False,
|
||||
inc_person: bool = False,
|
||||
inc_user_role_list: bool = False,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
):
|
||||
@@ -533,6 +534,7 @@ async def lookup_username(
|
||||
user_id = user_obj_result.get('user_id', None)
|
||||
user_obj = load_user_obj(
|
||||
user_id = user_id,
|
||||
inc_address = inc_address,
|
||||
inc_contact = inc_contact,
|
||||
inc_organization = inc_organization,
|
||||
inc_person = inc_person,
|
||||
@@ -546,6 +548,7 @@ async def lookup_username(
|
||||
user_obj_li.append(
|
||||
load_user_obj(
|
||||
user_id = user_id,
|
||||
inc_address = inc_address,
|
||||
inc_contact = inc_contact,
|
||||
inc_organization = inc_organization,
|
||||
inc_person = inc_person,
|
||||
|
||||
Reference in New Issue
Block a user