Changing hosted_file_link field names.

This commit is contained in:
Scott Idem
2021-06-18 09:58:31 -04:00
parent 6d4463e57e
commit bb2f14b67c
4 changed files with 46 additions and 36 deletions

View File

@@ -29,8 +29,8 @@ async def upload_files(
file_list: List[UploadFile] = File(...),
account_id: str = Form(..., min_length=1, max_length=22),
# filename: Optional[str] = Form(...),
for_object_type: str = Form(...),
for_object_id: str = Form(..., min_length=1, max_length=22),
link_to_type: str = Form(...),
link_to_id: str = Form(..., min_length=1, max_length=22),
check_allowed_extension: bool = False,
# create_hosted_file_link: bool = True,
x_account_id: str = Header(..., ),
@@ -46,9 +46,9 @@ async def upload_files(
else:
return mk_resp(data=None, status_code=400)
for_object_type = for_object_type
for_object_id_random = for_object_id # This is for the object random str ID
if for_object_id := redis_lookup_id_random(record_id_random=for_object_id, table_name=for_object_type): pass
link_to_type = link_to_type
link_to_id_random = link_to_id # This is for the object random str ID
if link_to_id := redis_lookup_id_random(record_id_random=link_to_id, table_name=link_to_type): pass
else:
return mk_resp(data=None, status_code=400)
@@ -58,9 +58,9 @@ async def upload_files(
file = file_obj,
account_id = account_id,
account_id_random = account_id_random,
for_object_type = for_object_type,
for_object_id = for_object_id,
for_object_id_random = for_object_id_random,
link_to_type = link_to_type,
link_to_id = link_to_id,
link_to_id_random = link_to_id_random,
check_allowed_extension = check_allowed_extension,
)
if file_info['saved']:
@@ -134,8 +134,8 @@ async def upload_files(
if create_hosted_file_link(
account_id=account_id,
hosted_file_id=hosted_file_id,
for_object_type=for_object_type,
for_object_id=for_object_id,
link_to_type=link_to_type,
link_to_id=link_to_id,
): pass # This if statement should be improved
else:
# This if statement should be improved
@@ -157,8 +157,8 @@ async def upload_files_fake(
file_info_li: list,
account_id: str,
# filename: Optional[str] = Form(...),
for_object_type: str,
for_object_id: str,
link_to_type: str,
link_to_id: str,
check_allowed_extension: bool = False,
# create_hosted_file_link: bool = True,
x_account_id: str = Header(..., ),
@@ -176,9 +176,9 @@ async def upload_files_fake(
else:
return mk_resp(data=None, status_code=400)
for_object_type = for_object_type
for_object_id_random = for_object_id # This is for the object random str ID
if for_object_id := redis_lookup_id_random(record_id_random=for_object_id, table_name=for_object_type): pass
link_to_type = link_to_type
link_to_id_random = link_to_id # This is for the object random str ID
if link_to_id := redis_lookup_id_random(record_id_random=link_to_id, table_name=link_to_type): pass
else:
return mk_resp(data=None, status_code=400)
@@ -262,8 +262,8 @@ async def upload_files_fake(
if create_hosted_file_link(
account_id=account_id,
hosted_file_id=hosted_file_id,
for_object_type=for_object_type,
for_object_id=for_object_id,
link_to_type=link_to_type,
link_to_id=link_to_id,
): pass # This if statement should be improved
else:
# This if statement should be improved
@@ -294,9 +294,9 @@ async def test_upload_files(
file = file_obj,
account_id = account_id,
account_id_random = account_id_random,
for_object_type = for_object_type,
for_object_id = for_object_id,
for_object_id_random = for_object_id_random,
link_to_type = link_to_type,
link_to_id = link_to_id,
link_to_id_random = link_to_id_random,
check_allowed_extension = check_allowed_extension,
)
log.debug(file_info)