schemas.py 422 B

1234567891011121314151617181920212223
  1. from pydantic import BaseModel, ConfigDict
  2. class UserCreate(BaseModel):
  3. name: str
  4. email: str
  5. password: str
  6. class UserResponse(BaseModel):
  7. id: int
  8. name: str
  9. email: str
  10. model_config = ConfigDict(from_attributes=True)
  11. class PostCreate(BaseModel):
  12. title: str
  13. content: str
  14. user_id: int
  15. class PostResponse(PostCreate):
  16. id: int
  17. model_config = ConfigDict(from_attributes=True)