from datetime import datetime from typing import Optional from pydantic import BaseModel from app.schemas.user import User # Shared properties class CommentBase(BaseModel): content: Optional[str] = None # Properties to receive via API on creation class CommentCreate(CommentBase): content: str post_id: int # Properties to receive via API on update class CommentUpdate(CommentBase): pass # Properties shared by models stored in DB class CommentInDBBase(CommentBase): id: int content: str author_id: int post_id: int created_at: datetime updated_at: datetime class Config: from_attributes = True # Properties to return to client class Comment(CommentInDBBase): author: User # Properties stored in DB class CommentInDB(CommentInDBBase): pass