Changing hosted_file_link field names.
This commit is contained in:
@@ -119,9 +119,9 @@ async def save_file(
|
||||
file: UploadFile,
|
||||
account_id: int,
|
||||
account_id_random: str,
|
||||
for_object_type: str,
|
||||
for_object_id: int,
|
||||
for_object_id_random: str,
|
||||
link_to_type: str,
|
||||
link_to_id: int,
|
||||
link_to_id_random: str,
|
||||
check_allowed_extension: bool = False,
|
||||
):
|
||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
@@ -136,9 +136,9 @@ async def save_file(
|
||||
|
||||
file_info: dict = {}
|
||||
file_info['saved'] = None
|
||||
file_info['for_object_type'] = for_object_type
|
||||
file_info['for_object_id'] = for_object_id
|
||||
file_info['for_object_id_random'] = for_object_id_random
|
||||
file_info['link_to_type'] = link_to_type
|
||||
file_info['link_to_id'] = link_to_id
|
||||
file_info['link_to_id_random'] = link_to_id_random
|
||||
file_info['filename'] = file.filename
|
||||
file_info['extension'] = guess_file_extension(filename=file.filename)
|
||||
|
||||
@@ -213,8 +213,8 @@ async def save_file(
|
||||
def create_hosted_file_link(
|
||||
account_id: int|str,
|
||||
hosted_file_id: int|str,
|
||||
link_to_obj_type: str,
|
||||
link_to_obj_id: int|str,
|
||||
link_to_type: str,
|
||||
link_to_id: int|str,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -223,14 +223,14 @@ def create_hosted_file_link(
|
||||
else: return False
|
||||
if hosted_file_id := redis_lookup_id_random(record_id_random=hosted_file_id, table_name='hosted_file'): pass
|
||||
else: return False
|
||||
if link_to_obj_id := redis_lookup_id_random(record_id_random=link_to_obj_id, table_name=link_to_obj_type): pass
|
||||
if link_to_id := redis_lookup_id_random(record_id_random=link_to_id, table_name=link_to_type): pass
|
||||
else: return False
|
||||
|
||||
hosted_file_link_data: dict = {}
|
||||
hosted_file_link_data['account_id'] = account_id
|
||||
hosted_file_link_data['hosted_file_id'] = hosted_file_id
|
||||
hosted_file_link_data['link_to_type'] = link_to_obj_type # Should this be renamed to "link_to_obj_type" for clarity?
|
||||
hosted_file_link_data['link_to_id'] = link_to_obj_id # Should this be renamed to "link_to_obj_id" for clarity?
|
||||
hosted_file_link_data['link_to_type'] = link_to_type # Should this be renamed to "link_to_type" for clarity?
|
||||
hosted_file_link_data['link_to_id'] = link_to_id # Should this be renamed to "link_to_id" for clarity?
|
||||
|
||||
# NOTE: Currently sql_insert does not handel all successful inserts correctly. If there is not an autonum ID then it will return 0 as the ID.
|
||||
if hosted_file_link_data_in_result := sql_insert(data=hosted_file_link_data, table_name='hosted_file_link', id_random_length=0): pass # This should be improved
|
||||
|
||||
Reference in New Issue
Block a user