Skip to content

Commit

Permalink
fix typing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
IMladjenovic committed Nov 28, 2024
1 parent 67aa954 commit c6d9947
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion backend/src/session/file_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@

UPLOADS_KEY_PREFIX = "file_upload_"


class FileUploadMeta(TypedDict):
uploadId: str
filename: str


class FileUpload(TypedDict):
uploadId: str
content: str
filename: str | None
contentType: str | None
size: int | None
content: str | None


def get_session_file_uploads_meta() -> list[FileUploadMeta] | None:
return get_session(UPLOADS_META_SESSION_KEY, [])


def get_session_file_upload(upload_id) -> FileUpload | None:
value = redis_client.get(UPLOADS_KEY_PREFIX + upload_id)
if value and isinstance(value, str):
Expand Down
2 changes: 1 addition & 1 deletion backend/src/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
MAX_FILE_SIZE = 10*1024*1024


def handle_file_upload(file:UploadFile) -> FileUpload:
def handle_file_upload(file: UploadFile) -> FileUpload:

if (file.size or 0) > MAX_FILE_SIZE:
raise HTTPException(status_code=413, detail=f"File upload must be less than {MAX_FILE_SIZE} bytes")
Expand Down

0 comments on commit c6d9947

Please sign in to comment.