Work on archives
This commit is contained in:
@@ -51,6 +51,9 @@ def get_archive_content_rec_list(
|
||||
for_obj_id: str,
|
||||
limit: int = 1000,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
sort_by_str: str = None,
|
||||
sort_by: str = None,
|
||||
sort_by_desc: bool = False,
|
||||
) -> list|bool:
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -78,13 +81,20 @@ def get_archive_content_rec_list(
|
||||
else:
|
||||
sql_limit = ''
|
||||
|
||||
if sort_by:
|
||||
sql_order_by = f'ORDER BY `tbl`.{sort_by}'
|
||||
if sort_by_desc:
|
||||
sql_order_by = f'{sql_order_by} {DESC}'
|
||||
else:
|
||||
sql_order_by = 'ORDER BY `tbl`.created_on DESC, `tbl`.updated_on DESC'
|
||||
|
||||
sql = f"""
|
||||
SELECT `tbl`.id AS 'archive_content_id', `tbl`.id_random AS 'archive_content_id_random'
|
||||
FROM `archive_content` AS `tbl`
|
||||
WHERE
|
||||
{sql_obj_type_id}
|
||||
{sql_enabled}
|
||||
ORDER BY `tbl`.created_on DESC, `tbl`.updated_on DESC
|
||||
{sql_order_by}
|
||||
{sql_limit};
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user