
- Implement Todo database model with SQLAlchemy - Set up Alembic for database migrations - Create CRUD operations for Todo items - Implement RESTful API endpoints - Add health check endpoint - Include comprehensive README with usage instructions
16 lines
594 B
Python
16 lines
594 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.database import Base
|
|
|
|
|
|
class Todo(Base):
|
|
"""SQLAlchemy model for Todo items."""
|
|
|
|
__tablename__ = "todos"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String, nullable=False)
|
|
description = Column(String, nullable=True)
|
|
completed = Column(Boolean, default=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) |