
- Set up project structure and dependencies - Create database models and schemas for tasks - Implement CRUD operations for tasks - Add API endpoints for task management - Create Alembic migrations for the database - Add health check endpoint - Implement error handling - Add documentation in README.md
35 lines
963 B
Python
35 lines
963 B
Python
from datetime import datetime
|
|
from enum import Enum as PyEnum
|
|
|
|
from sqlalchemy import Boolean, Column, DateTime, Enum, Integer, String, Text
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class TaskStatus(str, PyEnum):
|
|
TODO = "todo"
|
|
IN_PROGRESS = "in_progress"
|
|
DONE = "done"
|
|
|
|
|
|
class TaskPriority(str, PyEnum):
|
|
LOW = "low"
|
|
MEDIUM = "medium"
|
|
HIGH = "high"
|
|
|
|
|
|
class Task(Base):
|
|
"""Task model."""
|
|
|
|
__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.TODO)
|
|
priority = Column(Enum(TaskPriority), default=TaskPriority.MEDIUM)
|
|
due_date = Column(DateTime, nullable=True)
|
|
is_deleted = Column(Boolean, default=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|