feat(loyalty): multi-select categories on transactions
Some checks failed
Some checks failed
Switch from single category_id to category_ids JSON array on transactions. Sellers can now select multiple categories (e.g., Men + Accessories) when entering stamp/points transactions. - Migration loyalty_009: drop category_id FK, add category_ids JSON - Schemas: category_id → category_ids (list[int] | None) - Services: stamp_service + points_service accept category_ids - Terminal UI: pills are now multi-select (toggle on/off) - Transaction response: category_names (list[str]) resolved from IDs - Recent transactions table: new Category column showing comma- separated names Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,7 @@ from sqlalchemy import (
|
||||
String,
|
||||
Text,
|
||||
)
|
||||
from sqlalchemy.dialects.sqlite import JSON
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.core.database import Base
|
||||
@@ -104,11 +105,10 @@ class LoyaltyTransaction(Base, TimestampMixin):
|
||||
index=True,
|
||||
comment="Staff PIN used for this operation",
|
||||
)
|
||||
category_id = Column(
|
||||
Integer,
|
||||
ForeignKey("store_transaction_categories.id", ondelete="SET NULL"),
|
||||
category_ids = Column(
|
||||
JSON,
|
||||
nullable=True,
|
||||
comment="Product category (e.g., Men, Women, Accessories)",
|
||||
comment="List of category IDs selected for this transaction",
|
||||
)
|
||||
|
||||
# Related transaction (for voids/returns)
|
||||
|
||||
Reference in New Issue
Block a user