feat(#10706): add bulk operation status endpoint#11223
Open
Conversation
Introduce the @medic/bulk-operations shared library holding the document model that the bulk operation framework shares across delete, move and merge: the log document (medic-logs) read by the polling endpoint, and the per-action documents (medic-sentinel) that Sentinel processes in batches. buildBulkOperation assembles both from per-action operation lists. The per-item params live in a base64 json attachment so advancing an action's cursor does not rewrite the whole list.
Add GET /api/v1/bulk-operations/{id}, which returns the bulk operation log
document from the medic-logs database so a caller can poll the progress of
a delete, move or merge it started.
The service only resolves ids carrying the bulk-operation prefix, so the
endpoint cannot be used to read the other log documents that share the
database. Online users only; missing or non-bulk-operation ids return 404.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
GET /api/v1/bulk-operations/{id}so a caller can poll the progress of a bulk operation (delete, move or merge) by its id. It returns the operation's log document from themedic-logsdatabase, with the per-action status and the count of changes so far.The service only resolves ids that carry the
bulk-operation:prefix, so the endpoint can't be used to read the other log documents that sharemedic-logs. Online users only; a missing or non bulk-operation id returns 404. Documented with an OpenAPI annotation.Builds on #11222 (the
@medic/bulk-operationsdoc model). Until that one merges into the feature branch, the diff here also includes the doc model; it'll narrow to just the endpoint once #11222 lands.Part of #10706
Code review checklist
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.