Skip to content

Commit db0f7f7

Browse files
committed
return more metadata in self pastes
1 parent c9cab7c commit db0f7f7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

mystbin/backend/models/responses.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,16 @@ class Config:
9999
}
100100

101101

102-
class PasteGetAllResponse(BaseModel):
102+
class PasteGetAll(BaseModel):
103103
id: str
104-
loc: int
105-
charcount: int
104+
author_id: int
106105
created_at: datetime
106+
views: int
107107
expires: Optional[datetime] = None
108108
has_password: bool
109109

110+
class PasteGetAllResponse(BaseModel):
111+
pastes: List[PasteGetAll]
110112

111113
class TokenResponse(BaseModel):
112114
token: str

mystbin/backend/utils/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ async def get_all_user_pastes(self, author_id: Optional[int], limit: int, page:
403403
The potential list of pastes.
404404
"""
405405
query = """
406-
SELECT id, author_id, created_at,
406+
SELECT id, author_id, created_at, views, expires
407407
CASE WHEN password IS NOT NULL THEN true ELSE false END AS has_password
408408
FROM pastes
409409
WHERE author_id = $1

0 commit comments

Comments
 (0)