Create base schemas for common of attributes
This commit is contained in:
parent
89d691f51d
commit
43433d9dce
|
@ -3,27 +3,63 @@ from pydantic import BaseModel, EmailStr
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
class RegisterSchema(BaseModel):
|
class UserBase(BaseModel):
|
||||||
full_name: str
|
|
||||||
email: EmailStr
|
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
|
password: str
|
||||||
gender: int = Query(None, ge=1, le=3)
|
gender: int = Query(None, ge=1, le=3)
|
||||||
mobile: str = Query(None, min_length=8, max_length=13)
|
mobile: str = Query(None, min_length=8, max_length=13)
|
||||||
user_image: Optional[str] = None
|
user_image: Optional[str] = None
|
||||||
user_type: int = Query(None, ge=1, le=2)
|
|
||||||
lang_type: int = Query(None, ge=1, le=2)
|
|
||||||
device_type: int = Query(None, ge=1, le=2)
|
device_type: int = Query(None, ge=1, le=2)
|
||||||
device_id: str
|
city_id: int
|
||||||
|
access_key: str
|
||||||
|
badge: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
class LoginSchema(BaseModel):
|
class UserLogin(UserBase):
|
||||||
email: EmailStr
|
|
||||||
password: str
|
password: str
|
||||||
user_type: int = Query(None, ge=1, le=2)
|
|
||||||
lang_type: int = Query(None, ge=1, le=2)
|
class Config:
|
||||||
device_id: str
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
class OTPSchema(BaseModel):
|
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
|
access_key: str
|
||||||
otp: int = Query(None, ge=6, le=6)
|
otp: int = Query(None, ge=6, le=6)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
Loading…
Reference in New Issue