from datetime import datetime from typing import Optional from pydantic import BaseModel # Shared properties class CommentBase(BaseModel): content: Optional[str] = None # Properties to receive on comment creation class CommentCreate(CommentBase): content: str post_id: str # Properties to receive on comment update class CommentUpdate(CommentBase): pass # Properties shared by models stored in DB class CommentInDBBase(CommentBase): id: str post_id: str author_id: str created_at: datetime updated_at: datetime class Config: from_attributes = True # Properties to return to client class Comment(CommentInDBBase): pass # Properties stored in DB but not returned to the client class CommentInDB(CommentInDBBase): pass