
Features: - Project structure setup - Database configuration with SQLAlchemy - Item model and CRUD operations - API endpoints for items - Alembic migrations - Health check endpoint - Comprehensive documentation generated with BackendIM... (backend.im)
14 lines
587 B
Python
14 lines
587 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime, Text
|
|
from sqlalchemy.sql import func
|
|
from app.database import Base
|
|
|
|
class Item(Base):
|
|
__tablename__ = "items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(100), nullable=False)
|
|
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), onupdate=func.now()) |