
- Created FastAPI application with CRUD endpoints for todos - Set up SQLAlchemy with SQLite database - Created database models and Pydantic schemas - Added Alembic for database migrations - Added health check endpoint - Updated README with project information generated with BackendIM... (backend.im)
13 lines
534 B
Python
13 lines
534 B
Python
from sqlalchemy import Boolean, Column, Integer, String, DateTime
|
|
from sqlalchemy.sql import func
|
|
from .database 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), server_default=func.now(), onupdate=func.now()) |