
- 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
17 lines
740 B
Python
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") |