refac: robust file upload failed handling

This commit is contained in:
Timothy Jaeryang Baek committed 2025-09-24 12:17:01 -05:00
1 parent 05732de898
commit 23a51f2d01
2 files changed
+208 -180

No files matched your search

+11
View File
@@ -130,6 +130,17 @@ class FilesTable:
except Exception:
return None
def get_file_by_id_and_user_id(self, id: str, user_id: str) -> Optional[FileModel]:
with get_db() as db:
try:
file = db.query(File).filter_by(id=id, user_id=user_id).first()
if file:
return FileModel.model_validate(file)
else:
return None
except Exception:
return None
def get_file_metadata_by_id(self, id: str) -> Optional[FileMetadataResponse]:
with get_db() as db:
try: