mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: user init & refactors
This commit is contained in:
parent
b4dcc14749
commit
a50fc67104
25 changed files with 356 additions and 358 deletions
43
apps/api/src/db/users.py
Normal file
43
apps/api/src/db/users.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
from typing import Optional
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
class UserBase(SQLModel):
|
||||
username: str
|
||||
first_name: str
|
||||
last_name: str
|
||||
email: str
|
||||
avatar_image: Optional[str] = ""
|
||||
bio: Optional[str] = ""
|
||||
|
||||
|
||||
class UserCreate(UserBase):
|
||||
password: str
|
||||
|
||||
|
||||
class UserUpdate(UserBase):
|
||||
username: str
|
||||
first_name: Optional[str]
|
||||
last_name: Optional[str]
|
||||
email: str
|
||||
avatar_image: Optional[str] = ""
|
||||
bio: Optional[str] = ""
|
||||
|
||||
|
||||
class UserUpdatePassword(SQLModel):
|
||||
user_id: int
|
||||
old_password: str
|
||||
new_password: str
|
||||
|
||||
|
||||
class UserRead(UserBase):
|
||||
id: int
|
||||
|
||||
|
||||
class User(UserBase, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
password: str = ""
|
||||
user_uuid: str = ""
|
||||
email_verified: bool = False
|
||||
creation_date: str = ""
|
||||
update_date: str = ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue