
- Create project structure and configuration files - Set up database models and schemas for ToDo items - Implement CRUD operations for ToDo management - Create API endpoints for ToDo operations - Add health check endpoint - Set up Alembic for database migrations - Add comprehensive README documentation
17 lines
627 B
Python
17 lines
627 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.db.session import Base
|
|
|
|
|
|
class Todo(Base):
|
|
__tablename__ = "todos"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String, index=True)
|
|
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), onupdate=func.now())
|
|
|
|
def __repr__(self):
|
|
return f"<Todo(id={self.id}, title='{self.title}', completed={self.completed})>" |