add auth user pydantic schemas

This commit is contained in:
Jakub Miazek 2023-07-24 12:51:55 +02:00
parent d13d5abcda
commit 603225a0de

34
app/schemas/user.py Normal file
View File

@ -0,0 +1,34 @@
from uuid import UUID
from pydantic import BaseModel, Field, EmailStr, ConfigDict
config = ConfigDict(from_attributes=True)
# TODO: add pydantic field validator for strong password
class UserSchema(BaseModel):
model_config = config
email: EmailStr = Field(title="Users email", description="Users email")
first_name: str = Field(title="Users first name", description="Users first name")
last_name: str = Field(title="Users last name", description="Users last name")
password: str = Field(title="Users password", description="Users password")
class UserResponse(BaseModel):
uuid: UUID = Field(title="Users id", description="Users id")
email: EmailStr = Field(title="Users email", description="Users email")
first_name: str = Field(title="Users first name", description="Users first name")
last_name: str = Field(title="Users last name", description="Users last name")
access_token: str = Field(title="Users token", description="Users token")
class TokenResponse(BaseModel):
access_token: str = Field(title="Users access token", description="Users access token")
token_type: str = Field(title="Users token type", description="Users token type")
class UserLogin(BaseModel):
model_config = config
email: EmailStr = Field(title="Users email", description="Users email")
password: str = Field(title="Users password", description="Users password")