
- Set up project structure with FastAPI - Configure SQLite database with SQLAlchemy - Create Task model with Alembic migrations - Implement CRUD API endpoints for tasks - Add health check and CORS configuration - Update documentation
15 lines
646 B
Python
15 lines
646 B
Python
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, func
|
|
from app.db.session import Base
|
|
|
|
|
|
class Task(Base):
|
|
__tablename__ = "tasks"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(255), nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
is_completed = Column(Boolean, default=False)
|
|
priority = Column(Integer, default=1) # 1=Low, 2=Medium, 3=High
|
|
due_date = Column(DateTime, nullable=True)
|
|
created_at = Column(DateTime, default=func.now(), nullable=False)
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now(), nullable=False) |