
- Created FastAPI application with CRUD operations for tasks - Implemented SQLAlchemy models with Task entity - Added Pydantic schemas for request/response validation - Set up Alembic for database migrations - Configured SQLite database with proper file structure - Added health check and root endpoints - Included comprehensive API documentation - Applied CORS middleware for development - Updated README with detailed setup and usage instructions - Applied code formatting with ruff linter
29 lines
520 B
Python
29 lines
520 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class TaskBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
completed: bool = False
|
|
|
|
|
|
class TaskCreate(TaskBase):
|
|
pass
|
|
|
|
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
completed: Optional[bool] = None
|
|
|
|
|
|
class TaskResponse(TaskBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|