Add user update ability

This commit is contained in:
Esa Kataja
2025-05-16 12:18:10 +03:00
parent 0733965540
commit f6c6d96c02
2 changed files with 48 additions and 13 deletions
+8 -5
View File
@@ -26,7 +26,7 @@ class User(UserBase):
updated_at: datetime = Field(
description="Last update timestamp", examples=["2025-01-01T00:00:00.000Z"]
)
@property
def has_logged_in(self) -> bool:
"""Returns True if the user has ever logged in, False if last_login is the epoch date."""
@@ -46,9 +46,12 @@ class UserLogin(UserBase):
password: str = Field(description="Password of the user", examples=["sn1rbul4"])
class UserChangePassword(BaseModel):
class UpdateUser(BaseModel):
id: int = Field(description="ID of the user", examples=[1])
old_password: str = Field(
description="Old password of the user", examples=["sn1rbul4"]
avatar_id: int | None = Field(None, description="ID of the avatar", examples=[1])
email: str | None = Field(
None, description="Email of the user", examples=["[email protected]"]
)
password: str | None = Field(
None, description="Password of the user", examples=["p1p4l1"]
)
password: str = Field(description="Password of the user", examples=["p1p4l1"])