Draft: Add bulk notes/comments for issues [REST API]

What does this MR do and why?

Basically I've tried to implement a possibility to create several notes for some project's issues via REST API.

To achieve that goal the BulkOperation model was introduced. Rationale:

Bulk operation can be pretty weighty - that's why I suggest to move it to background (into BulkNotesCreateWorker and similar workers) and respond to user with an uuid of operation - to make it possible to track the progress.

Have tried to logically organize the changes by commits.

References

#524354

Screenshots or screen recordings

bulk_operation_notes.mp4

How to set up and validate locally

To play around locally:

  1. Run the migrations bundle exec rails db:migrate

  2. Create several similar notes for issues in some project by bulk operation curl --request POST --header "PRIVATE-TOKEN: <YOUR-TOKEN>" --header 'Content-Type: application/json' --data '{"noteable_type": "issue", "noteable_ids": [1, 2, 3, 4], "body": "BULK NOTE!"}' "http://127.0.0.1:3000/api/v4/projects/20/issues/bulk_notes"

  3. Use returned in response bulk_operation_uuid (e.g. f27d3334-644b-57d1-a179-c9aa252b24) to check it's status: curl --request GET --header "PRIVATE-TOKEN: <YOUR-TOKEN>" "http://127.0.0.1:3000/api/v4/bulk_operations/f27d3334-644b-57d1-a179-c9aa252b24"

  4. Check the issue's page

    image.png

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #524354

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading