ifixkart-admin/Backend/app/models/InventoryLedgerModel.py
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

22 lines
1.1 KiB
Python

import ulid
from sqlalchemy import Column, String, Integer, DateTime, Index
from sqlalchemy.sql import func
from app.core.database.db_session import Base
class InventoryLedger(Base):
__tablename__ = "inventory_ledger"
ledger_id = Column(String(26), primary_key=True, default=lambda: str(ulid.new()))
variant_id = Column(String(26), nullable=False, index=True)
event_type = Column(String(50), nullable=False, index=True) # RECEIPT, ONLINE_RESERVE, ONLINE_RESERVE_RELEASE, ONLINE_SALE_FROM_RESERVATION, DIRECT_ONLINE_SALE, POS_ALLOCATION, POS_SALE_FROM_ALLOCATION, DIRECT_POS_SALE, RETURN, DAMAGE
qty = Column(Integer, nullable=False)
warehouse_id = Column(String(26), nullable=True)
store_id = Column(String(26), nullable=True)
reference_id = Column(String(100), nullable=True, index=True) # Order ID / POS Tx ID
notes = Column(String(255), nullable=True)
created_at = Column(DateTime, server_default=func.now(), index=True)
__table_args__ = (
Index('idx_ledger_variant_event', 'variant_id', 'event_type', 'created_at'),
)