Automated Action d60cfb5c4f Create Task Manager API with FastAPI and SQLite
- Set up FastAPI project structure
- Create Task model with SQLAlchemy
- Set up Alembic for migrations
- Create CRUD operations for tasks
- Implement API endpoints for tasks
- Add health check endpoint
- Update documentation

generated with BackendIM... (backend.im)
2025-05-13 23:23:43 +00:00

40 lines
932 B
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
# Shared properties
class TaskBase(BaseModel):
title: str
description: Optional[str] = None
is_completed: bool = False
priority: int = Field(1, description="1 = Low, 2 = Medium, 3 = High", ge=1, le=3)
due_date: Optional[datetime] = None
# Properties to receive on task creation
class TaskCreate(TaskBase):
pass
# Properties to receive on task update
class TaskUpdate(TaskBase):
title: Optional[str] = None
is_completed: Optional[bool] = None
priority: Optional[int] = Field(None, description="1 = Low, 2 = Medium, 3 = High", ge=1, le=3)
# Properties shared by models stored in DB
class TaskInDBBase(TaskBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
# Properties to return to client
class Task(TaskInDBBase):
pass