Draft: Add bulk notes/comments for issues [REST API]
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
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
Screenshots or screen recordings
How to set up and validate locally
To play around locally:
-
Run the migrations
bundle exec rails db:migrate -
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" -
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" -
Check the issue's page
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
