This PR introduces a new endpoint /rules/batch for batch editing, and adds batchUpdate method to authenticate and validate (via BatchUpdateRuleForm) the request. Lastly DbRuleDraft.batchUpdateFromFormRule() updates the corresponding rules in the database. I have also added a test.
How to test
Run this locally (or on CODE but #342 would need to be merged to fix CODE permissions). Create multiple new rules and and send a POST request to /rules/batch with their IDs and new categories and/or tags to update e.g.
Thank you for your review and suggestions @jonathonherbert! I've tried to address them in my latest commit, appreciate if you could take another look. If anything looks wrong, please let me know.
What does this change?
This PR introduces a new endpoint
/rules/batch
for batch editing, and addsbatchUpdate
method to authenticate and validate (viaBatchUpdateRuleForm
) the request. LastlyDbRuleDraft.batchUpdateFromFormRule()
updates the corresponding rules in the database. I have also added a test.How to test
Run this locally (or on CODE but #342 would need to be merged to fix CODE permissions). Create multiple new rules and and send a POST request to
/rules/batch
with their IDs and new categories and/or tags to update e.g.Check that the relevant fields have been updated for these rules.