Skip to content

feat(#10706): add bulk operation document model#11222

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

feat(#10706): add bulk operation document model#11222
vikrantwiz02 wants to merge 2 commits into
medic:10706-dmp-2026-add-api-endpoints-for-advanced-contact-management-operationsfrom
vikrantwiz02:10706-bulk-operation-model

Conversation

@vikrantwiz02

Copy link
Copy Markdown
Contributor

Description

First piece of the bulk operation framework from the #10706 design: the shared document model that delete, move and merge all build on.

Adds the @medic/bulk-operations shared library with:

  • the action types (archive, set-contact, delete-user), statuses, and document id prefixes
  • buildBulkOperation(actionOperations, date), which builds the log document (medic-logs, read by the polling endpoint) and one action document per action type (medic-sentinel, processed by Sentinel in batches), cross-linked both ways
  • the per-item params stored in a base64 json operations attachment, so advancing an action's cursor later does not rewrite the whole list

No dependency on the archiving work, so it can land on its own. The queue helper that writes these docs and the GET /api/v1/bulk-operations/{id} polling endpoint follow next.

Part of #10706

Code review checklist

  • Readable: Concise, well named, follows the style guide
  • 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.
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