Skip to content

feat(files): batchFiles action for one-shot file operations#112

Merged
remko48 merged 2 commits intodevelopmentfrom
feat/files-batch-action
May 4, 2026
Merged

feat(files): batchFiles action for one-shot file operations#112
remko48 merged 2 commits intodevelopmentfrom
feat/files-batch-action

Conversation

@rubenvdlinde
Copy link
Copy Markdown
Contributor

@rubenvdlinde rubenvdlinde commented May 2, 2026

Summary

  • Adds batchFiles(type, objectId, action, fileIds, params?) to the files plugin — one POST to /files/batch replaces the N-sequential-calls loop.
  • Treats 200 (all OK) and 207 (partial) as valid; caller inspects data.summary for { succeeded, failed, total }.
  • Pure addition — publishFile / unpublishFile / deleteFile unchanged. Existing consumers continue to work.

Context

OpenRegister's file-actions change registered POST /api/objects/{register}/{schema}/{id}/files/batch (FilesController::batch). This shared-library addition lets every consumer (OR, OpenCatalogi, Procest, Pipelinq, MyDash) migrate their batch-action UIs from the N-call loop to one round-trip without duplicating fetch logic.

OpenRegister ViewObject.vue is the first consumer; the migration is paired on feat/openspec-batch-impl-2026-05-02.

(Targeting beta because origin/development no longer exists on GitHub; retarget on review if a different base is preferred.)

Test plan

  • npm test — 384/384 passing (+2 for new batchFiles tests covering 200 + 207 paths)
  • npm run check:docs — 106/106 documented
  • Reviewer: smoke-test ViewObject.vue's mass-actions against the OR backend

…label

Adds `batchFiles(type, objectId, action, fileIds, params?)` to the files
plugin. Replaces the N-sequential-calls pattern (loop calling
publishFile/unpublishFile/deleteFile per id) with a single POST to
`/files/batch`.

The backend returns 200 when every operation succeeds, or 207 (multi-status)
when some fail; per-file outcomes live in `data.results` and aggregate
counts in `data.summary` ({ succeeded, failed, total }). Both 200 and 207
are treated as valid responses — the caller inspects data.summary to
decide whether to surface a partial-failure UI.

Backwards compatible: existing publishFile / unpublishFile / deleteFile
actions are unchanged. Consumers that haven't migrated continue to work.

Closes OpenRegister file-actions task 136 (ViewObject.vue migration to
the batch endpoint, paired in a separate openregister commit).
@remko48 remko48 changed the base branch from beta to development May 4, 2026 12:12
@remko48 remko48 merged commit 865f5a4 into development May 4, 2026
1 check passed
@remko48 remko48 deleted the feat/files-batch-action branch May 4, 2026 15:02
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.

3 participants