Tomas Cohen Arazi
7a4cf3569d
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>
527 lines
14 KiB
JSON
527 lines
14 KiB
JSON
{
|
|
"/advanced_editor/macros": {
|
|
"get": {
|
|
"x-mojo-to": "AdvancedEditorMacro#list",
|
|
"operationId": "listMacro",
|
|
"tags": ["advancededitormacro"],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "name",
|
|
"in": "query",
|
|
"description": "Case insensative search on macro name",
|
|
"required": false,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "macro_text",
|
|
"in": "query",
|
|
"description": "Case insensative search on macro text",
|
|
"required": false,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "patron_id",
|
|
"in": "query",
|
|
"description": "Search on internal patron_id",
|
|
"required": false,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"name": "shared",
|
|
"in": "query",
|
|
"description": "Search on shared macros",
|
|
"required": false,
|
|
"type": "string"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "A list of macros",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": "advanced_editor"
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"x-mojo-to": "AdvancedEditorMacro#add",
|
|
"operationId": "addAdvancedEditorMacro",
|
|
"tags": ["advancededitormacro"],
|
|
"parameters": [{
|
|
"name": "body",
|
|
"in": "body",
|
|
"description": "A JSON object containing informations about the new macro",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Macro added",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Authentication required",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": "advanced_editor"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/advanced_editor/macros/shared": {
|
|
"post": {
|
|
"x-mojo-to": "AdvancedEditorMacro#add_shared",
|
|
"operationId": "addsharedAdvancedEditorMacro",
|
|
"tags": ["advancededitormacro"],
|
|
"parameters": [{
|
|
"name": "body",
|
|
"in": "body",
|
|
"description": "A JSON object containing informations about the new macro",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Macro added",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Authentication required",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": {
|
|
"advanced_editor": 1,
|
|
"create_shared_macros": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/advanced_editor/macros/{advancededitormacro_id}": {
|
|
"get": {
|
|
"x-mojo-to": "AdvancedEditorMacro#get",
|
|
"operationId": "getAdvancedEditorMacro",
|
|
"tags": ["advancededitormacros"],
|
|
"parameters": [{
|
|
"$ref": "../parameters.json#/advancededitormacro_id_pp"
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "A macro",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "AdvancedEditorMacro not found",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": "advanced_editor"
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"x-mojo-to": "AdvancedEditorMacro#update",
|
|
"operationId": "updateAdvancedEditorMacro",
|
|
"tags": ["advancededitormacros"],
|
|
"parameters": [{
|
|
"$ref": "../parameters.json#/advancededitormacro_id_pp"
|
|
}, {
|
|
"name": "body",
|
|
"in": "body",
|
|
"description": "An advanced editor macro object",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "An advanced editor macro",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Authentication required",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Macro not found",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": "advanced_editor"
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"x-mojo-to": "AdvancedEditorMacro#delete",
|
|
"operationId": "deleteAdvancedEditorMacro",
|
|
"tags": ["advancededitormacros"],
|
|
"parameters": [{
|
|
"$ref": "../parameters.json#/advancededitormacro_id_pp"
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Advanced editor macro deleted",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Authentication required",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Macro not found",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": "advanced_editor"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/advanced_editor/macros/shared/{advancededitormacro_id}": {
|
|
"get": {
|
|
"x-mojo-to": "AdvancedEditorMacro#get_shared",
|
|
"operationId": "getsharedAdvancedEditorMacro",
|
|
"tags": ["advancededitormacros"],
|
|
"parameters": [{
|
|
"$ref": "../parameters.json#/advancededitormacro_id_pp"
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "A macro",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "AdvancedEditorMacro not found",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": "advanced_editor"
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"x-mojo-to": "AdvancedEditorMacro#update_shared",
|
|
"operationId": "updatesharedAdvancedEditorMacro",
|
|
"tags": ["advancededitormacros"],
|
|
"parameters": [{
|
|
"$ref": "../parameters.json#/advancededitormacro_id_pp"
|
|
}, {
|
|
"name": "body",
|
|
"in": "body",
|
|
"description": "An advanced editor macro object",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "An advanced editor macro",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/advancededitormacro"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Authentication required",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Macro not found",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": {
|
|
"advanced_editor": 1,
|
|
"create_shared_macros": 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"x-mojo-to": "AdvancedEditorMacro#delete_shared",
|
|
"operationId": "deletesharedAdvancedEditorMacro",
|
|
"tags": ["advancededitormacros"],
|
|
"parameters": [{
|
|
"$ref": "../parameters.json#/advancededitormacro_id_pp"
|
|
}],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Advanced editor macro deleted",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Authentication required",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Access forbidden",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Macro not found",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"editcatalogue": {
|
|
"advanced_editor": 1,
|
|
"delete_shared_macros": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|