swag-shop/backend/app/schemas/user_schemas.py

20 lines
529 B
Python

from sqlmodel import Field as SqlModelField, SQLModel
from pydantic import EmailStr, Field
class UserRegister(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 Token(SQLModel):
access_token: str
token_type: str = "bearer"
class TokenPayload(SQLModel):
sub: str | None = None