feat(server/m7-coverage-gauge): GET /api/admin/library/coverage

New admin handler returns the library-wide cover-art coverage rollup
{total, with_art, pending, settled, pending_no_mbid} for the admin
dashboard gauge. Always 200; zeros on empty library. Same RequireAdmin
middleware as /api/admin/scan/status. Lives under a new /library/
admin sub-namespace, parallel to /scan/ (per-run state) and /covers/
(actions).

Tests gated on MINSTREL_TEST_DATABASE_URL: empty library returns all
zeros, mixed rows produce correct bucket math (verifying the
with_art + pending + settled = total invariant), non-admin returns 403.
This commit is contained in:
2026-05-06 09:54:56 -04:00
parent ff5868bdab
commit a1d295ebac
3 changed files with 186 additions and 0 deletions
+2
View File
@@ -114,6 +114,8 @@ func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, events *playev
admin.Get("/scan/status", h.handleGetScanStatus)
admin.Post("/scan/run", h.handleTriggerScan)
admin.Get("/library/coverage", h.handleGetLibraryCoverage)
})
authed.Get("/playlists", h.handleListPlaylists)