feat(api): media sources + scan status endpoints (#103 #106) #115

Merged
timothy merged 2 commits from feat/103-media-sources-api into main 2026-07-03 23:10:38 +02:00
Owner

Summary

  • Adds GET /api/media-sources for grouped media sources with child libraries, lastScan, and per-library item counts from a single grouped aggregate query.
  • Includes connected media sources even when they currently have zero qualifying/synced libraries, so #88 can render an empty source card.
  • Adds GET /api/libraries/scan-status to expose active in-memory scanner progress for SPA polling.
  • Adds focused NUnit/Shouldly/NSubstitute coverage for controller route metadata, MediatR pass-through, scan status mapping, the DB-backed media source read model, empty-source cards, and lastScan projection.
  • Rebases onto current main after PR #116 and regenerates ErsatzTV/wwwroot/openapi/v1.json in a separate commit.

Fixes #103.
Fixes #106.

Verification

  • dotnet build ErsatzTV.sln passed with existing NU1903 advisory warnings.
  • TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj -v minimal passed: 296 passed, 0 failed.
  • dotnet build -t:GenerateOpenApiDocuments --no-restore -m:1 /nodeReuse:false passed and regenerated OpenAPI. The plain ./scripts/update-openapi.sh target previously hung in dotnet build -t:GenerateOpenApiDocuments; the constrained equivalent target completed successfully.
## Summary - Adds `GET /api/media-sources` for grouped media sources with child libraries, `lastScan`, and per-library item counts from a single grouped aggregate query. - Includes connected media sources even when they currently have zero qualifying/synced libraries, so #88 can render an empty source card. - Adds `GET /api/libraries/scan-status` to expose active in-memory scanner progress for SPA polling. - Adds focused NUnit/Shouldly/NSubstitute coverage for controller route metadata, MediatR pass-through, scan status mapping, the DB-backed media source read model, empty-source cards, and `lastScan` projection. - Rebases onto current `main` after PR #116 and regenerates `ErsatzTV/wwwroot/openapi/v1.json` in a separate commit. Fixes #103. Fixes #106. ## Verification - `dotnet build ErsatzTV.sln` passed with existing NU1903 advisory warnings. - `TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj -v minimal` passed: 296 passed, 0 failed. - `dotnet build -t:GenerateOpenApiDocuments --no-restore -m:1 /nodeReuse:false` passed and regenerated OpenAPI. The plain `./scripts/update-openapi.sh` target previously hung in `dotnet build -t:GenerateOpenApiDocuments`; the constrained equivalent target completed successfully.
timothy added 2 commits 2026-07-03 22:27:53 +02:00
chore(openapi): regenerate v1 for media sources api (#103 #106)
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 4m25s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 5m37s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
bd8e54ae2d
timothy force-pushed feat/103-media-sources-api from bd8e54ae2d to 69486ab2d6 2026-07-03 23:03:16 +02:00 Compare
Author
Owner

Review follow-up applied:

  • Rebased PR #115 onto current main after PR #116.
  • Re-ran OpenAPI generation on the rebased tree.
  • Addressed MINOR-1 by returning connected media sources even when none of their libraries qualify, so the response can render an empty source card.
  • Addressed NIT-1 by asserting lastScan projection in the DB-backed handler test.
  • Left kind as a string for this PR; changing it to a DTO enum is a contract decision better made with the SPA type consumer.

Fresh local verification:

  • dotnet build ErsatzTV.sln passed with existing NU1903 warnings.
  • TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj -v minimal passed: 296 passed, 0 failed.
Review follow-up applied: - Rebased PR #115 onto current `main` after PR #116. - Re-ran OpenAPI generation on the rebased tree. - Addressed MINOR-1 by returning connected media sources even when none of their libraries qualify, so the response can render an empty source card. - Addressed NIT-1 by asserting `lastScan` projection in the DB-backed handler test. - Left `kind` as a string for this PR; changing it to a DTO enum is a contract decision better made with the SPA type consumer. Fresh local verification: - `dotnet build ErsatzTV.sln` passed with existing NU1903 warnings. - `TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj -v minimal` passed: 296 passed, 0 failed.
timothy merged commit b9955f4cba into main 2026-07-03 23:10:38 +02:00
Sign in to join this conversation.