feat(loyalty): restructure program CRUD by interface
Some checks failed
Some checks failed
Move program CRUD from store to merchant/admin interfaces. Store becomes view-only for program config while merchant gets full CRUD and admin gets override capabilities. Merchant portal: - New API endpoints (GET/POST/PATCH/DELETE /program) - New settings page with create/edit/delete form - Overview page now has Create/Edit Program buttons - Settings menu item added to sidebar Admin portal: - New CRUD endpoints (create for merchant, update, delete) - New activate/deactivate program endpoints - Programs list has edit and toggle buttons per row - Merchant detail has create/delete/toggle program actions Store portal: - Removed POST/PATCH /program endpoints (now read-only) - Removed settings page route and template - Terminal, cards, stats, enroll unchanged Tests: 112 passed (58 new) covering merchant API, admin CRUD, store endpoint removal, and program service unit tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,13 @@ def _get_admin_router():
|
||||
return admin_router
|
||||
|
||||
|
||||
def _get_merchant_router():
|
||||
"""Lazy import of merchant router to avoid circular imports."""
|
||||
from app.modules.loyalty.routes.api.merchant import router as merchant_router
|
||||
|
||||
return merchant_router
|
||||
|
||||
|
||||
def _get_store_router():
|
||||
"""Lazy import of store router to avoid circular imports."""
|
||||
from app.modules.loyalty.routes.api.store import store_router
|
||||
@@ -119,6 +126,7 @@ loyalty_module = ModuleDefinition(
|
||||
],
|
||||
FrontendType.MERCHANT: [
|
||||
"loyalty-overview", # Merchant loyalty overview
|
||||
"loyalty-settings", # Merchant loyalty settings
|
||||
],
|
||||
},
|
||||
# New module-driven menu definitions
|
||||
@@ -192,6 +200,13 @@ loyalty_module = ModuleDefinition(
|
||||
route="/merchants/loyalty/overview",
|
||||
order=10,
|
||||
),
|
||||
MenuItemDefinition(
|
||||
id="loyalty-settings",
|
||||
label_key="loyalty.menu.settings",
|
||||
icon="cog",
|
||||
route="/merchants/loyalty/settings",
|
||||
order=20,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -253,6 +268,7 @@ def get_loyalty_module_with_routers() -> ModuleDefinition:
|
||||
during module initialization.
|
||||
"""
|
||||
loyalty_module.admin_router = _get_admin_router()
|
||||
loyalty_module.merchant_router = _get_merchant_router()
|
||||
loyalty_module.store_router = _get_store_router()
|
||||
loyalty_module.platform_router = _get_platform_router()
|
||||
loyalty_module.storefront_router = _get_storefront_router()
|
||||
|
||||
Reference in New Issue
Block a user