Skip to content

Add admin stats update route - #1019

Merged
tudddorrr merged 1 commit into
developfrom
admin-stats-update-route
Aug 15, 2026
Merged

Add admin stats update route#1019
tudddorrr merged 1 commit into
developfrom
admin-stats-update-route

Conversation

@tudddorrr

@tudddorrr tudddorrr commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Admin API for updating game stats

  • Added a new PUT /admin/v1/game-stats/:id endpoint allowing admin API keys with the write:stats scope to update game stat properties.
  • Introduced loadStat middleware for admin routes that resolves a stat by ID scoped to the admin key's game, returning 404 if not found.

Shared update logic across route tiers

  • Extracted the stat update handler into a reusable updateStatHandler function that accepts an EntityManager, stat, validated body, and actor (either a User or AdminAPIKey).
  • Both the protected (dashboard) and admin API update routes now delegate to this shared handler, reducing duplication.

Deferred cache invalidation

  • Replaced inline clearStatIndexResponseCache middleware with a deferClearResponseCache call inside the shared handler, deferring the cache clear until after the database flush succeeds.

@tudddorrr tudddorrr added the enhancement New feature or request label Aug 15, 2026
@tudddorrr
tudddorrr force-pushed the admin-stats-update-route branch from f7165c2 to f0287c0 Compare August 15, 2026 08:43
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.33%. Comparing base (630a7df) to head (f0287c0).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1019      +/-   ##
===========================================
+ Coverage    98.31%   98.33%   +0.01%     
===========================================
  Files          440      442       +2     
  Lines         7251     7261      +10     
  Branches       972      973       +1     
===========================================
+ Hits          7129     7140      +11     
  Misses          49       49              
+ Partials        73       72       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tudddorrr
tudddorrr merged commit 3e5a1fb into develop Aug 15, 2026
10 checks passed
@tudddorrr
tudddorrr deleted the admin-stats-update-route branch August 15, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant