43 lines
908 B
Python

Sure, here's the `comments.py` file for the `app/api/v1/schemas/` directory in the `blog_app_igblf` FastAPI backend:
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
from app.db.base_class import Base
class CommentBase(BaseModel):
content: str = Field(..., min_length=1, max_length=1000)
class CommentCreate(CommentBase):
pass
class CommentUpdate(CommentBase):
pass
class CommentInDBBase(CommentBase):
id: int
created_at: datetime
updated_at: Optional[datetime] = None
post_id: int
class Config:
orm_mode = True
class Comment(CommentInDBBase):
pass
class CommentInDB(CommentInDBBase):
pass
This file defines the following Pydantic models for comments:
Note: You may need to adjust the import statements and the `Base` class import based on the actual structure of your `blog_app_igblf` project.