Work on sort of ressults using the priorty and sort fields.
This commit is contained in:
@@ -581,7 +581,7 @@ def delete_hosted_file_link(
|
||||
# ### BEGIN ### API Hosted File Methods ### get_hosted_file_rec_list() ###
|
||||
# This needs to be improved. Currently it does not really do anything.
|
||||
# Need to allow for list by account? Probably have the same actual hosted file have two hosted_file entries if it was uploaded for two separate accounts.
|
||||
# Updated 2022
|
||||
# Updated 2022-09-22
|
||||
@logger_reset
|
||||
def get_hosted_file_rec_list(
|
||||
for_obj_type: str,
|
||||
@@ -616,15 +616,18 @@ def get_hosted_file_rec_list(
|
||||
sql_limit = ''
|
||||
|
||||
sql = f"""
|
||||
SELECT `tbl`.id AS 'hosted_file_id', `tbl`.id_random AS 'hosted_file_id_random'
|
||||
FROM `hosted_file` AS `tbl`
|
||||
SELECT `hosted_file`.id AS 'hosted_file_id', `hosted_file`.id_random AS 'hosted_file_id_random'
|
||||
FROM `hosted_file` AS `hosted_file`
|
||||
WHERE
|
||||
{sql_obj_type_id}
|
||||
{sql_enabled}
|
||||
ORDER BY `tbl`.created_on DESC, `tbl`.updated_on DESC
|
||||
ORDER BY `hosted_file`.created_on DESC, `hosted_file`.updated_on DESC, `hosted_file`.filename ASC, `hosted_file`.extension ASC
|
||||
{sql_limit};
|
||||
"""
|
||||
|
||||
# NOTE: Use the ORDER BY below if priority and sort fields are added to the hosted_file table.
|
||||
# /* ORDER BY `hosted_file`.priority DESC, -`hosted_file`.sort DESC, `hosted_file`.created_on DESC, `hosted_file`.updated_on DESC, `hosted_file`.filename ASC, `hosted_file`.extension ASC */
|
||||
|
||||
if hosted_file_rec_li_result := sql_select(data=data, sql=sql, as_list=True):
|
||||
hosted_file_rec_li = hosted_file_rec_li_result
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user