
- Create FastAPI application with CORS support - Add SQLAlchemy models for Todo with timestamps - Set up SQLite database with proper configuration - Create CRUD operations for todo management - Add REST API endpoints for all todo operations - Configure Alembic for database migrations - Add Pydantic schemas for request/response validation - Include health check and root info endpoints - Set up proper project structure following best practices - Add comprehensive README with usage instructions
13 lines
565 B
Python
13 lines
565 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
from .db.base import Base
|
|
|
|
class Todo(Base):
|
|
__tablename__ = "todos"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String, index=True, nullable=False)
|
|
description = Column(String, nullable=True)
|
|
completed = Column(Boolean, default=False, nullable=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) |