diff --git a/schemas/user.py b/schemas/user.py new file mode 100644 index 0000000..0bf02ae --- /dev/null +++ b/schemas/user.py @@ -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 \ No newline at end of file