
- Created FastAPI application structure - Added Todo model and CRUD operations - Added database integration with SQLAlchemy - Added migrations with Alembic - Added health endpoint - Added API documentation with Swagger UI and ReDoc
17 lines
574 B
Python
17 lines
574 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
from .database import Base
|
|
|
|
|
|
class Todo(Base):
|
|
"""
|
|
Todo model representing a task to be done
|
|
"""
|
|
__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), onupdate=func.now()) |