| 1234567891011121314151617181920212223 |
- from pydantic import BaseModel, ConfigDict
- class UserCreate(BaseModel):
- name: str
- email: str
- password: str
- class UserResponse(BaseModel):
- id: int
- name: str
- email: str
- model_config = ConfigDict(from_attributes=True)
- class PostCreate(BaseModel):
- title: str
- content: str
- user_id: int
- class PostResponse(PostCreate):
- id: int
- model_config = ConfigDict(from_attributes=True)
|