Skip to content

feat(#10706): add bulk operation status endpoint#11223

Open
vikrantwiz02 wants to merge 4 commits into
medic:10706-dmp-2026-add-api-endpoints-for-advanced-contact-management-operationsfrom
vikrantwiz02:10706-bulk-operation-polling-endpoint
Open

feat(#10706): add bulk operation status endpoint#11223
vikrantwiz02 wants to merge 4 commits into
medic:10706-dmp-2026-add-api-endpoints-for-advanced-contact-management-operationsfrom
vikrantwiz02:10706-bulk-operation-polling-endpoint

Conversation

@vikrantwiz02

Copy link
Copy Markdown
Contributor

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 the medic-logs database, 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 share medic-logs. Online users only; a missing or non bulk-operation id returns 404. Documented with an OpenAPI annotation.

Builds on #11222 (the @medic/bulk-operations doc 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

  • Readable: Concise, well named, follows the style guide
  • Documented: OpenAPI annotation for the new endpoint
  • Tested: Unit and/or e2e where appropriate
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.
  • AI disclosure: Please disclose use of AI per the guidelines.

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

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.
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