
- Set up project structure with FastAPI and SQLAlchemy - Create Todo model, schemas, and CRUD operations - Add API endpoints for todo operations (create, read, update, delete) - Set up Alembic for database migrations - Add health check endpoint - Update README with detailed instructions generated with BackendIM... (backend.im)
14 lines
581 B
Python
14 lines
581 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime, func
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from app.database import Base
|
|
import datetime
|
|
|
|
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, default=datetime.datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow) |