Bug 25502: Adapt Advanced macros routes to current guidelines
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 14 May 2020 12:06:51 +0000 (09:06 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 19 May 2020 14:21:16 +0000 (15:21 +0100)
commit7a4cf3569d4c9c49aba43e3c524d8ac09474740a
tree8fda4cbee750c583fd540ef6ea1cbbfb72646599
parentb3ed9a40426bec52c1da9334818c49a6cbcfb464
Bug 25502: Adapt Advanced macros routes to current guidelines

The original development started before the changes we introduced in the guidelines in late 2019, and the major code changes that took place in January 2020.

- Attribute mapping logic is now on the Koha::Object-level (the patches implement that, but are not using it)
- Related to the above, some helper methods like to_api and to_model are kept, the same for the mappings in the controller, they should all go away
- Related to the above, set_from_api and new_from_api should be used instead of using helper to_api and to_model methods in the controller
- $c->objects->search doesn't use the to_model and to_api params
- Response status codes need to be changed, at least for DELETE operations

Those are fixed by this patch.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/advanced_editor_macros.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/V1/AdvancedEditorMacro.pm
api/v1/swagger/paths/advancededitormacros.json
t/db_dependent/api/v1/advanced_editor_macros.t