odapi/app/schemas.py

64 lines
1.4 KiB
Python

from fastapi import Query
from pydantic import BaseModel, EmailStr
from typing import Optional
class UserBase(BaseModel):
email: EmailStr
device_id: str
lang_type: int = Query(None, ge=1, le=2)
user_type: int = Query(None, ge=1, le=2)
class UserCreate(UserBase):
full_name: str
password: str
gender: int = Query(None, ge=1, le=3)
mobile: str = Query(None, min_length=8, max_length=13)
user_image: Optional[str] = None
device_type: int = Query(None, ge=1, le=2)
city_id: int
class Config:
orm_mode = True
class UserLogin(UserBase):
password: str
class Config:
orm_mode = True
class SocialLogin(UserBase):
type: int = Query(None, ge=1, le=2)
social_id: str
device_type: int = Query(None, ge=1, le=2)
mobile: str = Query(None, min_length=8, max_length=13)
full_name: str
class Config:
orm_mode = True
class CreateResponse(UserBase):
id: int
full_name: str
password: str
gender: int = Query(None, ge=1, le=3)
mobile: str = Query(None, min_length=8, max_length=13)
user_image: Optional[str] = None
device_type: int = Query(None, ge=1, le=2)
otp: int = Query(None, ge=6, le=6)
class Config:
orm_mode = True
class OTPVerify(BaseModel):
access_key: str
otp: int = Query(None, ge=6, le=6)
class Config:
orm_mode = True