
- Set up project structure with FastAPI - Implement SQLAlchemy models for User and Task - Create Alembic migrations - Implement authentication with JWT - Add CRUD operations for tasks - Add task filtering and prioritization - Configure health check endpoint - Update README with project documentation
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
|
|
from app.models.task import TaskPriority, TaskStatus
|
|
|
|
# Shared properties
|
|
class TaskBase(BaseModel):
|
|
title: str = Field(..., min_length=1, max_length=100)
|
|
description: Optional[str] = None
|
|
status: TaskStatus = TaskStatus.TODO
|
|
priority: TaskPriority = TaskPriority.MEDIUM
|
|
due_date: Optional[datetime] = None
|
|
|
|
# Properties to receive on task creation
|
|
class TaskCreate(TaskBase):
|
|
pass
|
|
|
|
# Properties to receive on task update
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
description: Optional[str] = None
|
|
status: Optional[TaskStatus] = None
|
|
priority: Optional[TaskPriority] = None
|
|
due_date: Optional[datetime] = None
|
|
completed_at: Optional[datetime] = None
|
|
|
|
# Properties shared by models stored in DB
|
|
class TaskInDBBase(TaskBase):
|
|
id: str
|
|
owner_id: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
completed_at: Optional[datetime] = None
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
# Properties to return to client
|
|
class Task(TaskInDBBase):
|
|
pass
|
|
|
|
# Properties stored in DB
|
|
class TaskInDB(TaskInDBBase):
|
|
pass
|