
- Created main FastAPI application with CORS middleware - Added SQLite database configuration with SQLAlchemy - Implemented Items model with create, read, update, delete operations - Set up Alembic migrations for database schema management - Added comprehensive API endpoints at /api/v1/items/ - Included health check endpoint at /health - Added proper Pydantic schemas for request/response validation - Updated README with complete documentation and usage instructions - Configured Ruff for code linting and formatting
14 lines
479 B
Python
14 lines
479 B
Python
from sqlalchemy import Column, Integer, String, Text, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
|
|
|
|
class Item(Base):
|
|
__tablename__ = "items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(100), nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|