Skip to content

Commit

Permalink
return all files props
Browse files Browse the repository at this point in the history
  • Loading branch information
amatanasovska committed Mar 16, 2024
1 parent c277d6b commit df8bee6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions backend/app/file_transfer/schemas.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import datetime
import uuid
from pydantic import BaseModel


Expand All @@ -7,10 +9,13 @@ class FileUploaded(BaseModel):


class MetadataFileResponse(BaseModel):
id: uuid.UUID
name: str
path: str
size: int
encrypted: bool
timestamp: datetime
expiration: datetime

class Config:
from_attributes = True
3 changes: 3 additions & 0 deletions backend/app/file_transfer/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ async def get_all_files_user(

return [
MetadataFileResponse(
id=file.id,
name=str(file.name),
path=str(file.path),
size=int(file.size), # type: ignore
encrypted=bool(file.encrypted),
timestamp=file.timestamp,
expiration=file.expiration,
)
for file in files.scalars()
]
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
export let toggleTheme = () => {};
export let currentTheme = 'light';
const useStyles = createStyles((theme) => {
return {
root: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/user/FileRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{file.encrypted}
</Text>
<Text size="sm" css={{ flex: 1 }}>
{file.size}
{Math.round(file.size/1024)}
</Text>
<Text size="sm" css={{ flex: 1 }}>
{file.timestamp}
Expand Down

0 comments on commit df8bee6

Please sign in to comment.