
- Setup project structure and FastAPI application - Configure SQLite database with SQLAlchemy ORM - Setup Alembic for database migrations - Implement user authentication with JWT - Create task models and CRUD operations - Implement task assignment functionality - Add detailed API documentation - Create comprehensive README with usage instructions - Lint code with Ruff
57 lines
1.2 KiB
Python
57 lines
1.2 KiB
Python
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.task import TaskPriority, TaskStatus
|
|
|
|
|
|
# Shared properties
|
|
class TaskBase(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
status: Optional[TaskStatus] = None
|
|
priority: Optional[TaskPriority] = None
|
|
due_date: Optional[datetime] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class TaskCreate(TaskBase):
|
|
title: str
|
|
status: TaskStatus = TaskStatus.TODO
|
|
priority: TaskPriority = TaskPriority.MEDIUM
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class TaskUpdate(TaskBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
class TaskInDBBase(TaskBase):
|
|
id: int
|
|
title: str
|
|
status: TaskStatus
|
|
priority: TaskPriority
|
|
owner_id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
completed_at: Optional[datetime] = None
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
# Properties to return via API
|
|
class Task(TaskInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties for tasks with assignee information
|
|
class TaskWithAssignees(Task):
|
|
assignee_ids: List[int] = []
|
|
|
|
|
|
# Properties stored in DB but not returned by API
|
|
class TaskInDB(TaskInDBBase):
|
|
is_deleted: bool = False
|