Automated Action 0474b30c3f Implement complete bookstore management API with FastAPI
- Added comprehensive book management with CRUD operations
- Implemented inventory tracking with stock management and reservations
- Created order management system with status tracking
- Integrated Stripe payment processing with payment intents
- Added SQLite database with SQLAlchemy ORM and Alembic migrations
- Implemented health check and API documentation endpoints
- Added comprehensive error handling and validation
- Configured CORS middleware for frontend integration
2025-06-25 10:34:27 +00:00

17 lines
740 B
Python

from sqlalchemy import Column, Integer, ForeignKey, DateTime
from sqlalchemy.sql import func
from sqlalchemy.orm import relationship
from app.db.base import Base
class Inventory(Base):
__tablename__ = "inventory"
id = Column(Integer, primary_key=True, index=True)
book_id = Column(Integer, ForeignKey("books.id"), nullable=False)
quantity = Column(Integer, nullable=False, default=0)
reserved_quantity = Column(Integer, nullable=False, default=0)
reorder_level = Column(Integer, nullable=False, default=10)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
book = relationship("Book", backref="inventory")