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>
133 lines
2.7 KiB
Python
133 lines
2.7 KiB
Python
# app/modules/loyalty/schemas/__init__.py
|
|
"""
|
|
Loyalty module Pydantic schemas.
|
|
|
|
Request and response models for the loyalty API endpoints.
|
|
|
|
Usage:
|
|
from app.modules.loyalty.schemas import (
|
|
# Program
|
|
ProgramCreate,
|
|
ProgramUpdate,
|
|
ProgramResponse,
|
|
# Card
|
|
CardEnrollRequest,
|
|
CardResponse,
|
|
# Stamp
|
|
StampRequest,
|
|
StampResponse,
|
|
# Points
|
|
PointsEarnRequest,
|
|
PointsRedeemRequest,
|
|
# PIN
|
|
PinCreate,
|
|
PinVerifyRequest,
|
|
)
|
|
"""
|
|
|
|
from app.modules.loyalty.schemas.program import (
|
|
# Program CRUD
|
|
ProgramCreate,
|
|
ProgramUpdate,
|
|
ProgramResponse,
|
|
ProgramListResponse,
|
|
# Points rewards
|
|
PointsRewardConfig,
|
|
TierConfig,
|
|
# Stats
|
|
ProgramStatsResponse,
|
|
CompanyStatsResponse,
|
|
# Company settings
|
|
CompanySettingsResponse,
|
|
CompanySettingsUpdate,
|
|
)
|
|
|
|
from app.modules.loyalty.schemas.card import (
|
|
# Card operations
|
|
CardEnrollRequest,
|
|
CardResponse,
|
|
CardDetailResponse,
|
|
CardListResponse,
|
|
CardLookupResponse,
|
|
# Transactions
|
|
TransactionResponse,
|
|
TransactionListResponse,
|
|
)
|
|
|
|
from app.modules.loyalty.schemas.stamp import (
|
|
# Stamp operations
|
|
StampRequest,
|
|
StampResponse,
|
|
StampRedeemRequest,
|
|
StampRedeemResponse,
|
|
StampVoidRequest,
|
|
StampVoidResponse,
|
|
)
|
|
|
|
from app.modules.loyalty.schemas.points import (
|
|
# Points operations
|
|
PointsEarnRequest,
|
|
PointsEarnResponse,
|
|
PointsRedeemRequest,
|
|
PointsRedeemResponse,
|
|
PointsVoidRequest,
|
|
PointsVoidResponse,
|
|
PointsAdjustRequest,
|
|
PointsAdjustResponse,
|
|
)
|
|
|
|
from app.modules.loyalty.schemas.pin import (
|
|
# Staff PIN
|
|
PinCreate,
|
|
PinUpdate,
|
|
PinResponse,
|
|
PinListResponse,
|
|
PinVerifyRequest,
|
|
PinVerifyResponse,
|
|
)
|
|
|
|
__all__ = [
|
|
# Program
|
|
"ProgramCreate",
|
|
"ProgramUpdate",
|
|
"ProgramResponse",
|
|
"ProgramListResponse",
|
|
"PointsRewardConfig",
|
|
"TierConfig",
|
|
"ProgramStatsResponse",
|
|
"CompanyStatsResponse",
|
|
"CompanySettingsResponse",
|
|
"CompanySettingsUpdate",
|
|
# Card
|
|
"CardEnrollRequest",
|
|
"CardResponse",
|
|
"CardDetailResponse",
|
|
"CardListResponse",
|
|
"CardLookupResponse",
|
|
"TransactionResponse",
|
|
"TransactionListResponse",
|
|
# Stamp
|
|
"StampRequest",
|
|
"StampResponse",
|
|
"StampRedeemRequest",
|
|
"StampRedeemResponse",
|
|
"StampVoidRequest",
|
|
"StampVoidResponse",
|
|
# Points
|
|
"PointsEarnRequest",
|
|
"PointsEarnResponse",
|
|
"PointsRedeemRequest",
|
|
"PointsRedeemResponse",
|
|
"PointsVoidRequest",
|
|
"PointsVoidResponse",
|
|
"PointsAdjustRequest",
|
|
"PointsAdjustResponse",
|
|
# PIN
|
|
"PinCreate",
|
|
"PinUpdate",
|
|
"PinResponse",
|
|
"PinListResponse",
|
|
"PinVerifyRequest",
|
|
"PinVerifyResponse",
|
|
]
|