
- Implemented CRUD operations for task management - Added task status tracking (pending, in_progress, completed) - Included priority levels (low, medium, high) - Set up SQLite database with Alembic migrations - Added filtering and pagination support - Configured CORS for all origins - Included health check endpoint - Added comprehensive API documentation - Formatted code with Ruff linting
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from app.models.task import TaskStatus, TaskPriority
|
|
|
|
|
|
class TaskBase(BaseModel):
|
|
title: str = Field(..., max_length=200, description="Task title")
|
|
description: Optional[str] = Field(None, description="Task description")
|
|
status: TaskStatus = Field(default=TaskStatus.PENDING, description="Task status")
|
|
priority: TaskPriority = Field(
|
|
default=TaskPriority.MEDIUM, description="Task priority"
|
|
)
|
|
|
|
|
|
class TaskCreate(TaskBase):
|
|
pass
|
|
|
|
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = Field(None, max_length=200, description="Task title")
|
|
description: Optional[str] = Field(None, description="Task description")
|
|
status: Optional[TaskStatus] = Field(None, description="Task status")
|
|
priority: Optional[TaskPriority] = Field(None, description="Task priority")
|
|
|
|
|
|
class TaskResponse(TaskBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|