
- Created FastAPI application with CRUD operations for todos - Implemented SQLite database with SQLAlchemy ORM - Added Alembic for database migrations - Set up CORS middleware for all origins - Added health check endpoint at /health - Created comprehensive API documentation - Formatted code with Ruff linter - Updated README with project information Features: - Create, read, update, delete todos - Pagination support for listing todos - Auto-generated OpenAPI documentation at /docs - Health monitoring endpoint
15 lines
512 B
Python
15 lines
512 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
|
|
|
|
class Todo(Base):
|
|
__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, server_default=func.now())
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|