opensupports/server/controllers/ticket/delete-custom-response.php

49 lines
1.2 KiB
PHP
Raw Normal View History

<?php
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
2017-04-17 04:59:11 +02:00
/**
* @api {post} /ticket/delete-custom-response Delete a custom response.
*
* @apiName Delete custom response
*
* @apiGroup Ticket
*
* @apiDescription This path delete a custom response.
*
* @apiPermission user
*
2017-04-21 08:09:24 +02:00
* @apiParam {Number} id Id of the custom response to delete.
2017-04-17 04:59:11 +02:00
*
2017-04-21 08:09:24 +02:00
* @apiUse NO_PERMISSION
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Empty object
2017-04-17 04:59:11 +02:00
*
*/
class DeleteCustomResponseController extends Controller {
const PATH = '/delete-custom-response';
const METHOD = 'POST';
public function validations() {
return [
'permission' => 'staff_2',
'requestData' => [
'id' => [
'validation' => DataValidator::dataStoreId('customresponse'),
'error' => ERRORS::INVALID_NAME
]
]
];
}
public function handler() {
$customResponse = CustomResponse::getDataStore(Controller::request('id'));
2016-11-23 02:27:05 +01:00
$customResponse->delete();
Log::createLog('DELETE_CUSTOM_RESPONSE', null);
Response::respondSuccess();
}
}