JourneyPoint / journeypoint / app / schemas / blogs.py
blogs.py
Raw
from pydantic import BaseModel
from datetime import datetime
from typing import Optional, Dict


class BlogCreate(BaseModel):
    username: str
    text_content: str
    image_url: Optional[str] = None


class BlogResponse(BlogCreate):
    id: int
    likes: int
    comments: Dict[str, str] = {}  # dict of username: comment
    created_at: datetime

    class Config:
        from_attributes = True