Skip to content

Commit

Permalink
Optimize File Listing Response for Folders (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
berggren authored Nov 6, 2024
1 parent f1bfb00 commit af765ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/v1/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def get_folder_files(
folder_id: str,
db: Session = Depends(get_db_connection),
current_user: schemas.User = Depends(get_current_active_user),
) -> List[schemas.FileResponse]:
) -> List[schemas.FileResponseCompactList]:
return get_files_from_db(db, folder_id)


Expand Down
12 changes: 12 additions & 0 deletions src/api/v1/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,22 @@ class FileResponse(BaseSchema):


class FileResponseCompact(BaseSchemaCompact):
display_name: str
filesize: int
uuid: UUID
is_deleted: Optional[bool] = False


# This is used for the folder list
class FileResponseCompactList(BaseModel):
id: Optional[int] = None
display_name: str
filesize: int
data_type: str
magic_mime: Optional[str] = None
user: UserResponseCompact
created_at: Optional[datetime] = None
is_deleted: Optional[bool] = False


class FileSummaryCreate(BaseModel):
Expand Down

0 comments on commit af765ed

Please sign in to comment.