29 lines
762 B
Python
29 lines
762 B
Python
from sqlmodel import Field as SqlModelField, SQLModel
|
|
from pydantic import EmailStr, Field
|
|
|
|
|
|
class UserRegisterSchema(SQLModel):
|
|
username: str = Field(..., min_length=3, max_length=64)
|
|
email: EmailStr = Field(...)
|
|
phone_number: str = Field(..., min_length=2, max_length=16, pattern=r'^\+[1-9]\d{1,14}$')
|
|
password: str = Field(..., min_length=6, max_length=128)
|
|
shop_id: int = 0
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class UserLoginSchema(SQLModel):
|
|
shop_id: int = 0
|
|
username: str = Field(..., min_length=3, max_length=64)
|
|
password: str = Field(..., min_length=6, max_length=128)
|
|
|
|
|
|
class Token(SQLModel):
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
|
|
|
|
class TokenPayload(SQLModel):
|
|
sub: str | None = None
|