Spaces:
Running
Running
| from datetime import datetime | |
| from typing import Optional | |
| from pydantic import BaseModel | |
| from app.schemas.user import UserResponse | |
| class PostBase(BaseModel): | |
| title: str | |
| content: str | |
| published: bool = True | |
| class PostCreate(PostBase): | |
| pass | |
| class PostUpdate(BaseModel): | |
| title: Optional[str] = None | |
| content: Optional[str] = None | |
| published: Optional[bool] = None | |
| class PostResponse(PostBase): | |
| id: int | |
| created_at: datetime | |
| owner_id: int | |
| owner: UserResponse | |
| class Config: | |
| from_attributes = True | |
| class PostVote(PostResponse): | |
| votes: int |