
- Create complete task management system with CRUD operations - Add Task model with status, priority, timestamps - Set up SQLite database with SQLAlchemy and Alembic migrations - Implement RESTful API endpoints for task operations - Configure CORS middleware and API documentation - Add health check endpoint and root information response - Include proper project structure and comprehensive README
28 lines
896 B
Python
28 lines
896 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, String, Text, DateTime, Enum
|
|
from app.db.base import Base
|
|
import enum
|
|
|
|
|
|
class TaskStatus(str, enum.Enum):
|
|
PENDING = "pending"
|
|
IN_PROGRESS = "in_progress"
|
|
COMPLETED = "completed"
|
|
|
|
|
|
class TaskPriority(str, enum.Enum):
|
|
LOW = "low"
|
|
MEDIUM = "medium"
|
|
HIGH = "high"
|
|
|
|
|
|
class Task(Base):
|
|
__tablename__ = "tasks"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(255), nullable=False)
|
|
description = Column(Text, nullable=True)
|
|
status = Column(Enum(TaskStatus), default=TaskStatus.PENDING, nullable=False)
|
|
priority = Column(Enum(TaskPriority), default=TaskPriority.MEDIUM, nullable=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False) |