
- Created FastAPI application structure with main.py and requirements.txt - Setup SQLite database with SQLAlchemy models for tasks - Implemented Alembic migrations for database schema management - Added CRUD endpoints for task management (GET, POST, PUT, DELETE) - Configured CORS middleware to allow all origins - Added health endpoint and base route with API information - Updated README with comprehensive documentation - Applied code formatting with Ruff linter
26 lines
575 B
Python
26 lines
575 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
|
|
priority: str = "medium"
|
|
|
|
class TaskCreate(TaskBase):
|
|
pass
|
|
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
completed: Optional[bool] = None
|
|
priority: Optional[str] = None
|
|
|
|
class Task(TaskBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |