Backend: bulk channel operations API (renumber, move to group, bulk delete) #98

Closed
opened 2026-07-02 18:48:48 +02:00 by timothy · 1 comment
Owner

The Channels prototype's selection action bar offers Renumber, Move to group, and Delete across selected channels. Today: per-row PUT /api/channels/{id} already carries Number/Group/IsEnabled/ShowInEpg, and single DELETE /api/channels/{id} exists — but there is no bulk or renumber endpoint (upstream did renumbering via a Blazor "Edit Channel Numbers" flow with no API).

Do

  • Add bulk operations: renumber (reassign channel numbers for a set/sequence), move to group (set Group for a set of channel ids), and bulk delete. Make them atomic where practical.
  • Reuse existing UpdateChannel/DeleteChannel handlers where possible.

Acceptance: #84's bulk action bar (Renumber / Move to group / Delete selected) works against real endpoints. Move-to-group and bulk-delete could degrade to client-side loops initially; renumber needs a real endpoint.

Supports #84 (bulk actions). Parent: #59.

The Channels prototype's **selection action bar** offers **Renumber**, **Move to group**, and **Delete** across selected channels. Today: per-row `PUT /api/channels/{id}` already carries `Number`/`Group`/`IsEnabled`/`ShowInEpg`, and single `DELETE /api/channels/{id}` exists — but there is **no bulk or renumber endpoint** (upstream did renumbering via a Blazor "Edit Channel Numbers" flow with no API). **Do** - Add bulk operations: **renumber** (reassign channel numbers for a set/sequence), **move to group** (set `Group` for a set of channel ids), and **bulk delete**. Make them atomic where practical. - Reuse existing `UpdateChannel`/`DeleteChannel` handlers where possible. **Acceptance:** #84's bulk action bar (Renumber / Move to group / Delete selected) works against real endpoints. Move-to-group and bulk-delete could degrade to client-side loops initially; **renumber needs a real endpoint**. Supports #84 (bulk actions). Parent: #59.
timothy added the enhancementapi labels 2026-07-02 18:48:48 +02:00
timothy added a new dependency 2026-07-02 18:48:48 +02:00
Author
Owner

Done

What was done: Added backend bulk channel operations for the Channels action bar: POST /api/channels/bulk/renumber, POST /api/channels/bulk/group, and POST /api/channels/bulk/delete. Renumbering reuses and hardens the existing UpdateChannelNumbers flow with prevalidation for missing ids, duplicate ids/numbers, invalid number format, and conflicts with non-selected channels. Move-to-group and delete are server-side bulk handlers with all-requested-channel validation and transactional database updates where practical. Committed and pushed as 6b3a6982 on docs/59-ui-redesign-brief.

Root cause: n/a - enhancement/API coverage gap.

Files changed: Channel bulk command records and handlers under ErsatzTV.Application/Channels/Commands; API request DTOs and ChannelController routes; controller/handler/OpenAPI tests; OpenAPI v1.json; generated web API types.

Verification: git diff --check; npm run typecheck in web; /usr/bin/env TZ=UTC dotnet test ErsatzTV.sln -v minimal. All exited 0. Existing NuGet vulnerability warnings for Microsoft.OpenApi and Scriban.Signed remain present.

Deferred: none.

Follow-up issues: none.

Docs updated: Static OpenAPI document and generated frontend API types updated; no operational docs impact.

## Done **What was done**: Added backend bulk channel operations for the Channels action bar: `POST /api/channels/bulk/renumber`, `POST /api/channels/bulk/group`, and `POST /api/channels/bulk/delete`. Renumbering reuses and hardens the existing `UpdateChannelNumbers` flow with prevalidation for missing ids, duplicate ids/numbers, invalid number format, and conflicts with non-selected channels. Move-to-group and delete are server-side bulk handlers with all-requested-channel validation and transactional database updates where practical. Committed and pushed as `6b3a6982` on `docs/59-ui-redesign-brief`. **Root cause**: n/a - enhancement/API coverage gap. **Files changed**: Channel bulk command records and handlers under `ErsatzTV.Application/Channels/Commands`; API request DTOs and `ChannelController` routes; controller/handler/OpenAPI tests; OpenAPI `v1.json`; generated web API types. **Verification**: `git diff --check`; `npm run typecheck` in `web`; `/usr/bin/env TZ=UTC dotnet test ErsatzTV.sln -v minimal`. All exited 0. Existing NuGet vulnerability warnings for `Microsoft.OpenApi` and `Scriban.Signed` remain present. **Deferred**: none. **Follow-up issues**: none. **Docs updated**: Static OpenAPI document and generated frontend API types updated; no operational docs impact.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Blocks
Reference: timothy/ersatztv#98