Complete implementation of loyalty module Phase 2 features: Database & Models: - Add company_id to LoyaltyProgram for chain-wide loyalty - Add company_id to LoyaltyCard for multi-location support - Add CompanyLoyaltySettings model for admin-controlled settings - Add points expiration, welcome bonus, and minimum redemption fields - Add POINTS_EXPIRED, WELCOME_BONUS transaction types Services: - Update program_service for company-based queries - Update card_service with enrollment and welcome bonus - Update points_service with void_points for returns - Update stamp_service for company context - Update pin_service for company-wide operations API Endpoints: - Admin: Program listing with stats, company detail views - Vendor: Terminal operations, card management, settings - Storefront: Customer card/transactions, self-enrollment UI Templates: - Admin: Programs dashboard, company detail, settings - Vendor: Terminal, cards list, card detail, settings, stats, enrollment - Storefront: Dashboard, history, enrollment, success pages Background Tasks: - Point expiration task (daily, based on inactivity) - Wallet sync task (hourly) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
66 lines
1.4 KiB
Python
66 lines
1.4 KiB
Python
# app/modules/loyalty/models/__init__.py
|
|
"""
|
|
Loyalty module database models.
|
|
|
|
This is the canonical location for loyalty models. Module models are automatically
|
|
discovered and registered with SQLAlchemy's Base.metadata at startup.
|
|
|
|
Usage:
|
|
from app.modules.loyalty.models import (
|
|
LoyaltyProgram,
|
|
LoyaltyCard,
|
|
LoyaltyTransaction,
|
|
StaffPin,
|
|
AppleDeviceRegistration,
|
|
CompanyLoyaltySettings,
|
|
LoyaltyType,
|
|
TransactionType,
|
|
StaffPinPolicy,
|
|
)
|
|
"""
|
|
|
|
from app.modules.loyalty.models.loyalty_program import (
|
|
# Enums
|
|
LoyaltyType,
|
|
# Model
|
|
LoyaltyProgram,
|
|
)
|
|
from app.modules.loyalty.models.loyalty_card import (
|
|
# Model
|
|
LoyaltyCard,
|
|
)
|
|
from app.modules.loyalty.models.loyalty_transaction import (
|
|
# Enums
|
|
TransactionType,
|
|
# Model
|
|
LoyaltyTransaction,
|
|
)
|
|
from app.modules.loyalty.models.staff_pin import (
|
|
# Model
|
|
StaffPin,
|
|
)
|
|
from app.modules.loyalty.models.apple_device import (
|
|
# Model
|
|
AppleDeviceRegistration,
|
|
)
|
|
from app.modules.loyalty.models.company_settings import (
|
|
# Enums
|
|
StaffPinPolicy,
|
|
# Model
|
|
CompanyLoyaltySettings,
|
|
)
|
|
|
|
__all__ = [
|
|
# Enums
|
|
"LoyaltyType",
|
|
"TransactionType",
|
|
"StaffPinPolicy",
|
|
# Models
|
|
"LoyaltyProgram",
|
|
"LoyaltyCard",
|
|
"LoyaltyTransaction",
|
|
"StaffPin",
|
|
"AppleDeviceRegistration",
|
|
"CompanyLoyaltySettings",
|
|
]
|