
Added complete task management functionality including: - CRUD operations for tasks (create, read, update, delete) - Task model with status (pending/in_progress/completed) and priority (low/medium/high) - SQLite database with SQLAlchemy ORM - Alembic migrations for database schema - Pydantic schemas for request/response validation - FastAPI routers with proper error handling - Filtering and pagination support - Health check endpoint - CORS configuration - Comprehensive API documentation - Proper project structure following FastAPI best practices
36 lines
714 B
Python
36 lines
714 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
from app.models.task import TaskStatus, TaskPriority
|
|
|
|
|
|
class TaskBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
status: TaskStatus = TaskStatus.PENDING
|
|
priority: TaskPriority = TaskPriority.MEDIUM
|
|
|
|
|
|
class TaskCreate(TaskBase):
|
|
pass
|
|
|
|
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
status: Optional[TaskStatus] = None
|
|
priority: Optional[TaskPriority] = None
|
|
|
|
|
|
class TaskInDB(TaskBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class Task(TaskInDB):
|
|
pass
|