File size: 496 Bytes
252d749 591d823 252d749 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from typing import List, Optional
from pydantic import EmailStr, BaseModel
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
class UserSchema(BaseModel):
pk: int
id: int
name: str
class Config:
orm_mode = True
class BaseRequest(BaseModel):
email: EmailStr
name: str
password: str
phoneNumber: Optional[str]
def hash_password(self):
self.password = pwd_context.hash(self.password)
|