Automated Action 06df0285b1 Implement Blogging Platform API with FastAPI and SQLite
- Set up project structure and dependencies
- Create database models for users, posts, comments, and tags
- Set up Alembic for database migrations
- Implement user authentication (register, login)
- Create CRUD endpoints for blog posts, comments, and tags
- Add health check endpoint
- Set up proper error handling
- Update README with project details and setup instructions
2025-06-02 21:58:50 +00:00

45 lines
814 B
Python

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