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

17 lines
575 B
Python

from pydantic import BaseModel, EmailStr, Field
class UserRegisterSchema(BaseModel):
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:
orm_mode = True
class UserLoginSchema(BaseModel):
shop_id: int = 0
username: str = Field(..., min_length=3, max_length=64)
password: str = Field(..., min_length=6, max_length=128)