Code clean up. Working on returning proper 404 vs 400 responses if the results are empty and nothing went wrong.
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, PrivateAttr, ValidationError, validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random, sql_insert, sql_insert_or_update, sql_select, sql_update
|
||||
from app.lib_general import log, logging
|
||||
from app.lib_general import log, logging, logger_reset
|
||||
|
||||
|
||||
from app.models.common_field_schema import default_num_bytes
|
||||
@@ -43,6 +43,8 @@ def load_activity_log_obj(
|
||||
|
||||
|
||||
# ### BEGIN ### API Activity Log Methods ### get_activity_log_rec_list() ###
|
||||
# Updated 2021-12-13
|
||||
@logger_reset
|
||||
def get_activity_log_rec_list(
|
||||
account_id: str,
|
||||
from_datetime: datetime.datetime = None,
|
||||
@@ -50,7 +52,7 @@ def get_activity_log_rec_list(
|
||||
limit: int = 1000,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
) -> list|bool:
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
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
|
||||
@@ -88,9 +90,9 @@ def get_activity_log_rec_list(
|
||||
|
||||
if activity_log_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
|
||||
activity_log_rec_li = activity_log_rec_li_result
|
||||
else:
|
||||
activity_log_rec_li = []
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
else: # [] or False
|
||||
activity_log_rec_li = activity_log_rec_li_result
|
||||
|
||||
log.debug(activity_log_rec_li_result)
|
||||
|
||||
return activity_log_rec_li
|
||||
|
||||
Reference in New Issue
Block a user