fix(loyalty): wire merchant staff PIN form to team-member autocomplete
Some checks failed
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / ruff (push) Successful in 16s
CI / pytest (push) Has been cancelled

The shared loyalty pins list factory has an autocomplete-from-team
flow gated behind config.staffApiPrefix (loaded once into a list, then
filtered client-side). The merchant entry in static/merchant/js/loyalty-pins.js
never set staffApiPrefix, so the loadStaffMembers branch never ran and
the "Staff member name" field on /merchants/loyalty/pins fell back to
free text instead of suggesting actual team members.

Wire the merchant config to /merchants/account, and add a flat
GET /merchants/account/team/members alias next to the existing
/merchants/account/team that returns just {members: [...]} — matching
the shape the shared autocomplete factory already expects at
${prefix}/team/members.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 21:20:07 +02:00
parent eaffc764ec
commit 573b0ef483
2 changed files with 16 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ const merchantPinsLog = window.LogConfig.loggers.merchantPins || window.LogConfi
function merchantLoyaltyPins() {
return loyaltyPinsList({
apiPrefix: '/merchants/loyalty',
staffApiPrefix: '/merchants/account',
showStoreFilter: true,
showCrud: true,
currentPage: 'pins',

View File

@@ -179,6 +179,21 @@ async def merchant_team_overview(
return merchant_store_service.get_merchant_team_members(db, merchant.id)
@_account_router.get("/team/members")
async def merchant_team_members_list(
merchant=Depends(get_merchant_for_current_user),
db: Session = Depends(get_db),
):
"""Flat ``{members: [...]}`` view of merchant team members.
Same data as ``GET /team`` but with the wrapper fields stripped, so it
matches the shape store-side autocomplete factories already expect at
``${prefix}/team/members``.
"""
full = merchant_store_service.get_merchant_team_members(db, merchant.id)
return {"members": full["members"]}
@_account_router.get("/team/stores/{store_id}/roles")
async def merchant_team_store_roles(
store_id: int,