Add User schema

This commit is contained in:
Backend IM Bot 2025-03-28 05:57:18 -05:00
parent f55cadcbf4
commit 887b63b40e

27
schemas/user.py Normal file
View File

@ -0,0 +1,27 @@
from pydantic import BaseModel, Field, EmailStr
class UserBase(BaseModel):
first_name: str = Field(..., description="User's first name")
last_name: str = Field(..., description="User's last name")
email: EmailStr = Field(..., description="User's email address")
is_active: bool = Field(True, description="Whether the user is active or not")
class UserCreate(UserBase):
password: str = Field(..., min_length=8, description="User's password")
class Config:
schema_extra = {
"example": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"password": "securepassword123",
"is_active": True
}
}
class UserResponse(UserBase):
id: int = Field(..., description="User's unique identifier")
class Config:
orm_mode = True