Fund-management admin page: recurrence/prize-kind enum drift (400s) + domain/action pickers #875

Closed
opened 2026-07-27 14:30:22 +00:00 by spikerj · 1 comment
Owner

Part of #868 (PR-8, angular + small backend).

Bugs in admin → sponsorship-management → Location funds (fund-management.component.ts):

  • Recurrence options ["Once","Daily","Weekly","Unlimited"] vs backend RewardRecurrence Once|OncePerDay|Unlimited — picking Daily/Weekly is a guaranteed 400, and OncePerDay isn't offered at all.
  • Prize kind "FirstCompletion" vs backend FundPrizeKind.FirstToEarn — guaranteed 400.
  • domain/action are free-text; server validates against KnowledgeDomainRegistry and rejects unregistered/client-side pairs, so typos 400 late. Replace with pickers fed from the registry (add GET /api/sponsor/funds/admin/registry (AdminOrStaff) exposing server-trustworthy (domain, action) pairs if no such endpoint exists).

Deferred (follow-up): condition editor for MetadataConditions/StateConditions — FE request interface already declares them, saveRule() never sends them, so the state providers are unreachable from the UI.

Part of #868 (PR-8, angular + small backend). Bugs in admin → sponsorship-management → Location funds (`fund-management.component.ts`): - Recurrence options `["Once","Daily","Weekly","Unlimited"]` vs backend `RewardRecurrence Once|OncePerDay|Unlimited` — picking Daily/Weekly is a guaranteed 400, and OncePerDay isn't offered at all. - Prize kind `"FirstCompletion"` vs backend `FundPrizeKind.FirstToEarn` — guaranteed 400. - `domain`/`action` are free-text; server validates against `KnowledgeDomainRegistry` and rejects unregistered/client-side pairs, so typos 400 late. Replace with pickers fed from the registry (add `GET /api/sponsor/funds/admin/registry` (AdminOrStaff) exposing server-trustworthy (domain, action) pairs if no such endpoint exists). Deferred (follow-up): condition editor for `MetadataConditions`/`StateConditions` — FE request interface already declares them, `saveRule()` never sends them, so the state providers are unreachable from the UI.
Author
Owner

Resolved in spikersoft-angular PR #592 (consolidated family-card epic PR, 501a3ada). The standalone PR #591 was closed unmerged in favour of the consolidation. Verified against origin/master:

Enum drift fixed

  • fund-management.component.ts:131recurrences = ["Once", "OncePerDay", "Unlimited"] (Daily/Weekly gone, OncePerDay added).
  • :132prizeKinds = ["CumulativeEarnings", "FirstToEarn"] (FirstCompletion gone).
  • Both pinned by fund-management.component.spec.ts:45-47, so the drift can't silently return.

Domain/action pickers

  • fund-management.component.html:353-354 (domain) and :366-367 (action); component.ts:141-144 filters to !isClientSide, so only reward-eligible pairs are offered — matching the server's IsRegistered validation at FundsController.cs:739.
  • Field shapes line up across the wire: C# DomainDefinition(Domain, DisplayName, Category, Actions) / ActionDefinition(Action, DisplayName, Group, IsClientSide) at KnowledgeDomainRegistry.cs:5-15 vs TS RegistryAction/RegistryDomain at fund-management.component.ts:21-35.

Two notes:

  • No new /api/sponsor/funds/admin/registry endpoint was added — the pickers read the pre-existing GET /api/activity/domains (ActivityController.cs:240). The ticket conditioned a new endpoint on "if no such endpoint exists", so this satisfies it. That endpoint is [AllowAnonymous] rather than AdminOrStaff, but it returns only the static registry catalog and predates this work, so it's not a regression introduced here — worth a separate ticket if the exposure bothers you.
  • The MetadataConditions/StateConditions editor is explicitly deferred in the ticket body and isn't counted against this.

Closing.

Resolved in spikersoft-angular PR #592 (consolidated family-card epic PR, `501a3ada`). The standalone PR #591 was closed unmerged in favour of the consolidation. Verified against `origin/master`: **Enum drift fixed** - `fund-management.component.ts:131` — `recurrences = ["Once", "OncePerDay", "Unlimited"]` (`Daily`/`Weekly` gone, `OncePerDay` added). - `:132` — `prizeKinds = ["CumulativeEarnings", "FirstToEarn"]` (`FirstCompletion` gone). - Both pinned by `fund-management.component.spec.ts:45-47`, so the drift can't silently return. **Domain/action pickers** - `fund-management.component.html:353-354` (domain) and `:366-367` (action); `component.ts:141-144` filters to `!isClientSide`, so only reward-eligible pairs are offered — matching the server's `IsRegistered` validation at `FundsController.cs:739`. - Field shapes line up across the wire: C# `DomainDefinition(Domain, DisplayName, Category, Actions)` / `ActionDefinition(Action, DisplayName, Group, IsClientSide)` at `KnowledgeDomainRegistry.cs:5-15` vs TS `RegistryAction`/`RegistryDomain` at `fund-management.component.ts:21-35`. Two notes: - No new `/api/sponsor/funds/admin/registry` endpoint was added — the pickers read the pre-existing `GET /api/activity/domains` (`ActivityController.cs:240`). The ticket conditioned a new endpoint on "if no such endpoint exists", so this satisfies it. That endpoint is `[AllowAnonymous]` rather than AdminOrStaff, but it returns only the static registry catalog and predates this work, so it's not a regression introduced here — worth a separate ticket if the exposure bothers you. - The MetadataConditions/StateConditions editor is explicitly deferred in the ticket body and isn't counted against this. Closing.
Sign in to join this conversation.