
This API provides endpoints for: - Product and inventory management - Customer management - Order processing - Payment processing with Stripe integration - User authentication generated with BackendIM... (backend.im)
18 lines
739 B
Python
18 lines
739 B
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base_class import Base
|
|
|
|
|
|
class Inventory(Base):
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
product_id = Column(Integer, ForeignKey("product.id"), unique=True)
|
|
quantity = Column(Integer, nullable=False, default=0)
|
|
location = Column(String, nullable=True)
|
|
last_restock_date = Column(DateTime(timezone=True), nullable=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
# Relationships
|
|
product = relationship("Product", back_populates="inventory") |