Skip to content

Commit 92592a2

Browse files
authored
Update schemas.py
1 parent 8a06441 commit 92592a2

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎app/validation/schemas.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class RefreshIn(BaseModel):
3838
refresh_token: str
3939

4040

41+
class PasswordChange(BaseModel):
42+
old_password: str = Field(min_length=1, max_length=128)
43+
new_password: str = Field(min_length=8, max_length=128)
44+
45+
4146
class UserOut(BaseModel):
4247
id: str
4348
email: str
@@ -46,6 +51,26 @@ class UserOut(BaseModel):
4651
created_at: datetime
4752

4853

54+
class AccountProfile(BaseModel):
55+
"""Everything the account dropdown and 个人中心 page need, in one read.
56+
57+
``points`` is the sum of ``plan_points`` and ``pack_points`` (never
58+
stored separately); ``points_expire_at`` is null for 无有效期.
59+
``works`` is the user's conversation count (the app's "创作").
60+
``name`` has no column yet — it is derived from the email.
61+
"""
62+
63+
name: str
64+
email: str
65+
plan: str
66+
phone: str | None
67+
points: int
68+
plan_points: int
69+
pack_points: int
70+
points_expire_at: datetime | None
71+
works: int
72+
73+
4974
# --- conversations ---
5075

5176

0 commit comments

Comments
 (0)