
- Set up project structure and dependencies - Implement database models with SQLAlchemy - Set up Alembic migrations - Create FastAPI application with CORS support - Implement API endpoints (CRUD operations) - Add health check endpoint - Update README with setup and usage instructions
15 lines
640 B
Python
15 lines
640 B
Python
from sqlalchemy import Column, Integer, String, Text, DateTime, Boolean
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base_class import Base
|
|
|
|
class Item(Base):
|
|
"""Database model for items."""
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(255), nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
price = Column(Integer, nullable=False) # Price in cents
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) |