feat: add SQL query tool, platform debug, loyalty settings, and multi-module improvements
Some checks failed
CI / ruff (push) Successful in 14s
CI / pytest (push) Failing after 50m12s
CI / validate (push) Successful in 25s
CI / dependency-scanning (push) Successful in 32s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped

- Add admin SQL query tool with saved queries, schema explorer presets,
  and collapsible category sections (dev_tools module)
- Add platform debug tool for admin diagnostics
- Add loyalty settings page with owner-only access control
- Fix loyalty settings owner check (use currentUser instead of window.__userData)
- Replace HTTPException with AuthorizationException in loyalty routes
- Expand loyalty module with PIN service, Apple Wallet, program management
- Improve store login with platform detection and multi-platform support
- Update billing feature gates and subscription services
- Add store platform sync improvements and remove is_primary column
- Add unit tests for loyalty (PIN, points, stamps, program services)
- Update i18n translations across dev_tools locales

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 20:08:07 +01:00
parent a77a8a3a98
commit 319900623a
77 changed files with 5341 additions and 401 deletions

View File

@@ -47,9 +47,16 @@ class SubscriptionService:
# Store Resolution
# =========================================================================
def resolve_store_to_merchant(self, db: Session, store_id: int) -> tuple[int, int]:
def resolve_store_to_merchant(
self, db: Session, store_id: int, platform_id: int | None = None
) -> tuple[int, int]:
"""Resolve store_id to (merchant_id, platform_id).
Args:
db: Database session
store_id: Store ID
platform_id: Platform ID from JWT token. When provided, skips DB lookup.
Raises:
ResourceNotFoundException: If store not found or has no platform
"""
@@ -59,7 +66,8 @@ class SubscriptionService:
store = store_service.get_store_by_id_optional(db, store_id)
if not store or not store.merchant_id:
raise ResourceNotFoundException("Store", str(store_id))
platform_id = platform_service.get_primary_platform_id_for_store(db, store_id)
if platform_id is None:
platform_id = platform_service.get_first_active_platform_id_for_store(db, store_id)
if not platform_id:
raise ResourceNotFoundException("StorePlatform", f"store_id={store_id}")
return store.merchant_id, platform_id
@@ -185,7 +193,7 @@ class SubscriptionService:
if merchant_id is None:
return None
platform_id = platform_service.get_primary_platform_id_for_store(db, store_id)
platform_id = platform_service.get_first_active_platform_id_for_store(db, store_id)
if platform_id is None:
return None