Skip to content

feat(sportsbook): read a player's sportsbook restriction - #337

Open
okapitula wants to merge 1 commit into
feat/sportsbook-promotionsfrom
feat/sportsbook-restriction-read
Open

okapitula wants to merge 1 commit into
feat/sportsbook-promotionsfrom
feat/sportsbook-restriction-read

Conversation

@okapitula

Copy link
Copy Markdown
Collaborator

Stacked on #336. Review that PR first; this one retargets to dev once it merges.

Summary

Adds GET /backoffice/sportsbook/players/{userId}/restriction, which returns a player's current sportsbook restriction. It sits under the sportsbook:view grant and returns an unrestricted state when no restriction is in place.

Why

Admins could restrict a player or lift a restriction, but nothing showed the current state. A back office had to change the restriction before it could show whether the player was blocked. The new read uses the same SportsbookRestriction shape the restrict and lift routes return. Staff who can view the sportsbook can see the state, and changing it still needs sportsbook:suspend. An unknown user id returns 404, the same as the write routes.

Alternatives considered

  • Adding the restriction to a wider player read. That would tie a sportsbook-only state to another module's surface. A route next to the restrict and lift routes keeps the resource in one place.
  • Requiring sportsbook:suspend for the read. Support and review staff need to see why a player can't bet without being able to change it, so the read uses the view grant.

Risks

None. This adds a read-only route and changes no existing contract, table or migration. The player-existence check moved into a shared helper and now uses the strict identity lookup, so a database error during the check returns 500 instead of a false 404.

Comment thread packages/core/src/sportsbook/betting/router/index.ts
@klaudia-blazyczek-blurify

Copy link
Copy Markdown
Collaborator

LGTM. I'm giving approve, but it would be good if other dev also reviews this PR

Admin UIs had no way to show whether a player is restricted until an admin changed it. The new GET route returns the current state under the sportsbook view grant, unrestricted when no restriction row exists.
@okapitula
okapitula force-pushed the feat/sportsbook-restriction-read branch from 135adef to 3a1979c Compare October 26, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants