Skip to content

Add batch action routes for multi-selection Kitsu operations#1145

Open
frankrousseau wants to merge 4 commits into
cgwire:mainfrom
frankrousseau:main
Open

Add batch action routes for multi-selection Kitsu operations#1145
frankrousseau wants to merge 4 commits into
cgwire:mainfrom
frankrousseau:main

Conversation

@frankrousseau

Copy link
Copy Markdown
Contributor

Problem

  • Several Kitsu multi-selection actions call the API once per selected item, sending N requests where one would do: adding a selection or a whole episode/movie to a playlist, deleting a selection of assets/shots/edits/concepts, updating casting on a selection, and changing task priority on a selection.
  • Adding entities to a playlist had no batch route at all, so clients rewrote the full playlist once per entity, racing against concurrent edits.

Solution

  • Add POST /actions/playlists/<id>/add-entities: appends several entities in one write under the playlist lock, each getting its latest uploaded preview file (restricted to the playlist task type when set), skipping entities already present.
  • Add POST /actions/projects/<id>/delete-entities: deletes assets/shots/edits/concepts by id list, with the same cancel-then-remove semantics and per-entity creator-or-manager permission check as the single deletion routes, validating everything before deleting anything.
  • Add PUT /data/projects/<id>/entities/casting: updates several entities' casting in one request from an entity-id to casting-array map, validating project membership for every entity up front.
  • Add PUT /actions/tasks/set-priority: sets the priority of a task id list, mirroring clear-assignation's per-task supervisor permission check and skipping forbidden tasks.
  • All routes are additive; existing single-entity routes are unchanged. Tests added for each route.

frankrousseau and others added 4 commits July 7, 2026 23:57
Adding a selection or a whole episode to a playlist required one
add-entity call per entity, or client-side rewrites of the full
playlist. The new route appends several entities in one database write
under the playlist lock, picking for each one its latest uploaded
preview file, restricted to the playlist task type when one is set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deleting a selection of assets, shots, edits or concepts required one
request per entity. The new route accepts an id list and applies the
same rules as the single deletion routes: entities with tasks are
canceled first, then removed for real when already canceled, concepts
are always removed, and the creator-or-manager permission is checked
per entity before anything is deleted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Updating the casting of a selection (add an asset to several shots,
paste a casting) required one full-replace request per entity. The new
route accepts a map of entity ids to casting arrays and updates them
all in one request, validating project membership for every entity
before writing anything.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Changing the priority of a task selection required one update request
per task. The new route mirrors clear-assignation: it takes a task id
list plus a priority, applies the same per-task supervisor permission
check as the single task update, skips forbidden tasks and returns the
updated tasks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant