User email look up improvement
This commit is contained in:
@@ -126,7 +126,7 @@ def load_event_presentation_obj(
|
|||||||
if inc_event_person_list: pass
|
if inc_event_person_list: pass
|
||||||
|
|
||||||
if inc_event_presenter_list:
|
if inc_event_presenter_list:
|
||||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
data['event_presentation_id'] = event_presentation_id
|
data['event_presentation_id'] = event_presentation_id
|
||||||
@@ -166,8 +166,10 @@ def load_event_presentation_obj(
|
|||||||
{sql_enabled}
|
{sql_enabled}
|
||||||
ORDER BY `event_presenter`.priority DESC, `event_presenter`.sort ASC, `event_presenter`.family_name ASC, `event_presenter`.given_name ASC, `event_presenter`.display_name ASC, `event_presenter`.full_name ASC, `event_presenter`.created_on DESC, `event_presenter`.updated_on DESC;
|
ORDER BY `event_presenter`.priority DESC, `event_presenter`.sort ASC, `event_presenter`.family_name ASC, `event_presenter`.given_name ASC, `event_presenter`.display_name ASC, `event_presenter`.full_name ASC, `event_presenter`.created_on DESC, `event_presenter`.updated_on DESC;
|
||||||
"""
|
"""
|
||||||
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
log.debug(sql)
|
||||||
|
log.debug(data)
|
||||||
|
|
||||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
|
||||||
if event_presenter_obj_li_result := sql_select(data=data, sql=sql, as_list=True):
|
if event_presenter_obj_li_result := sql_select(data=data, sql=sql, as_list=True):
|
||||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(event_presenter_obj_li_result)
|
log.debug(event_presenter_obj_li_result)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def load_event_session_obj(
|
|||||||
exclude_unset: bool = True,
|
exclude_unset: bool = True,
|
||||||
model_as_dict: bool = False,
|
model_as_dict: bool = False,
|
||||||
) -> Event_Session_Base|bool:
|
) -> Event_Session_Base|bool:
|
||||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
if event_session_id := redis_lookup_id_random(record_id_random=event_session_id, table_name='event_session'): pass
|
if event_session_id := redis_lookup_id_random(record_id_random=event_session_id, table_name='event_session'): pass
|
||||||
|
|||||||
@@ -44,15 +44,15 @@ async def post_event_file_obj(
|
|||||||
|
|
||||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||||
async def patch_event_file_obj(
|
async def patch_event_file_obj(
|
||||||
obj: Event_File_Base,
|
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
obj: Event_File_Base = None,
|
||||||
x_account_id: Optional[str] = Header(..., ),
|
x_account_id: Optional[str] = Header(..., ),
|
||||||
return_obj: Optional[bool] = True,
|
return_obj: Optional[bool] = True,
|
||||||
by_alias: Optional[bool] = True,
|
by_alias: Optional[bool] = True,
|
||||||
exclude_unset: Optional[bool] = True,
|
exclude_unset: Optional[bool] = True,
|
||||||
response: Response = Response,
|
response: Response = Response,
|
||||||
):
|
):
|
||||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
obj_type = 'event_file'
|
obj_type = 'event_file'
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ async def get_event_session_obj(
|
|||||||
exclude_unset: Optional[bool] = True,
|
exclude_unset: Optional[bool] = True,
|
||||||
response: Response = Response,
|
response: Response = Response,
|
||||||
):
|
):
|
||||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
if event_session_id := redis_lookup_id_random(record_id_random=event_session_id, table_name='event_session'): pass
|
if event_session_id := redis_lookup_id_random(record_id_random=event_session_id, table_name='event_session'): pass
|
||||||
|
|||||||
@@ -582,6 +582,8 @@ async def lookup_email(
|
|||||||
inc_contact: bool = False,
|
inc_contact: bool = False,
|
||||||
inc_organization: bool = False,
|
inc_organization: bool = False,
|
||||||
inc_person: bool = False,
|
inc_person: bool = False,
|
||||||
|
enabled: str = 'enabled', # enabled, disabled, all
|
||||||
|
limit: int = 1,
|
||||||
by_alias: bool = True,
|
by_alias: bool = True,
|
||||||
exclude_unset: bool = True,
|
exclude_unset: bool = True,
|
||||||
response: Response = Response,
|
response: Response = Response,
|
||||||
@@ -600,6 +602,22 @@ async def lookup_email(
|
|||||||
data = {}
|
data = {}
|
||||||
data['account_id'] = account_id
|
data['account_id'] = account_id
|
||||||
data['email'] = email
|
data['email'] = email
|
||||||
|
|
||||||
|
if enabled in ['enabled', 'disabled', 'all']:
|
||||||
|
if enabled == 'enabled':
|
||||||
|
data['enable'] = True
|
||||||
|
sql_enabled = f'AND `user`.enable = :enable'
|
||||||
|
elif enabled == 'disabled':
|
||||||
|
data['enable'] = False
|
||||||
|
sql_enabled = f'AND `user`.enable = :enable'
|
||||||
|
elif enabled == 'all':
|
||||||
|
sql_enabled = ''
|
||||||
|
else:
|
||||||
|
return mk_resp(data=None, status_code=400, response=response) # Bad Request
|
||||||
|
|
||||||
|
data['limit'] = limit
|
||||||
|
sql_limit = f'LIMIT :limit'
|
||||||
|
|
||||||
log.debug(data)
|
log.debug(data)
|
||||||
|
|
||||||
if account_id:
|
if account_id:
|
||||||
@@ -607,12 +625,16 @@ async def lookup_email(
|
|||||||
SELECT id AS 'user_id', id_random AS 'user_id_random'
|
SELECT id AS 'user_id', id_random AS 'user_id_random'
|
||||||
FROM `user` AS `user`
|
FROM `user` AS `user`
|
||||||
WHERE `user`.account_id = :account_id AND `user`.email = :email
|
WHERE `user`.account_id = :account_id AND `user`.email = :email
|
||||||
|
{sql_enabled}
|
||||||
|
{sql_limit};
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
sql = f"""
|
sql = f"""
|
||||||
SELECT id AS 'user_id', id_random AS 'user_id_random'
|
SELECT id AS 'user_id', id_random AS 'user_id_random'
|
||||||
FROM `user` AS `user`
|
FROM `user` AS `user`
|
||||||
WHERE `user`.account_id IS NULL AND `user`.email = :email
|
WHERE `user`.account_id IS NULL AND `user`.email = :email
|
||||||
|
{sql_enabled}
|
||||||
|
{sql_limit};
|
||||||
"""
|
"""
|
||||||
log.debug(sql)
|
log.debug(sql)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user