mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add details and profile fields to User model with JSON support
This commit is contained in:
parent
af17deff30
commit
6ff53915a8
2 changed files with 38 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from typing import Optional
|
||||
from pydantic import BaseModel, EmailStr
|
||||
from sqlmodel import Field, SQLModel
|
||||
from sqlalchemy import JSON, Column
|
||||
from src.db.roles import RoleRead
|
||||
|
||||
|
||||
|
|
@ -12,7 +13,8 @@ class UserBase(SQLModel):
|
|||
email: EmailStr
|
||||
avatar_image: Optional[str] = ""
|
||||
bio: Optional[str] = ""
|
||||
|
||||
details: Optional[dict] = Field(default={}, sa_column=Column(JSON))
|
||||
profile: Optional[dict] = Field(default={}, sa_column=Column(JSON))
|
||||
|
||||
class UserCreate(UserBase):
|
||||
first_name: str = ""
|
||||
|
|
@ -27,6 +29,8 @@ class UserUpdate(UserBase):
|
|||
email: str
|
||||
avatar_image: Optional[str] = ""
|
||||
bio: Optional[str] = ""
|
||||
details: Optional[dict] = {}
|
||||
profile: Optional[dict] = {}
|
||||
|
||||
|
||||
class UserUpdatePassword(SQLModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue