From ce63b407e09f13d444b2b072c8da1a9aa257694c Mon Sep 17 00:00:00 2001 From: AntonyAntonio Date: Fri, 21 Apr 2017 03:09:24 -0300 Subject: [PATCH] Guillermo - things [skip ci] --- server/controllers/article/add-topic.php | 9 ++++--- server/controllers/article/add.php | 14 +++++------ server/controllers/article/delete-topic.php | 7 +++--- server/controllers/article/delete.php | 7 +++--- server/controllers/article/edit-topic.php | 14 +++++------ server/controllers/article/edit.php | 21 +++++++--------- server/controllers/article/get-all.php | 8 ++++--- server/controllers/staff/add.php | 20 ++++++++-------- server/controllers/staff/assign-ticket.php | 11 +++++---- server/controllers/staff/delete.php | 7 +++--- server/controllers/staff/edit.php | 15 +++++------- server/controllers/staff/get-all-tickets.php | 9 +++---- server/controllers/staff/get-all.php | 6 +++-- server/controllers/staff/get-new-tickets.php | 6 +++-- server/controllers/staff/get-tickets.php | 6 +++-- server/controllers/staff/get.php | 8 +++---- server/controllers/staff/last-events.php | 9 +++---- server/controllers/staff/search-tickets.php | 11 +++++---- server/controllers/staff/un-assign-ticket.php | 9 +++---- server/controllers/system/add-api-key.php | 6 +++-- server/controllers/system/add-department.php | 5 ++-- server/controllers/system/backup-database.php | 2 +- .../controllers/system/check-requirements.php | 4 ++-- server/controllers/system/csv-import.php | 10 ++++---- .../controllers/system/delete-all-users.php | 7 ++++-- server/controllers/system/delete-api-key.php | 7 +++--- .../controllers/system/delete-department.php | 11 +++++---- .../system/disable-registration.php | 7 +++--- .../system/disable-user-system.php | 10 ++++---- server/controllers/system/edit-department.php | 10 ++++---- .../controllers/system/edit-mail-template.php | 19 ++++++++------- server/controllers/system/edit-settings.php | 12 ++++------ .../system/enable-registration.php | 7 +++--- .../controllers/system/enable-user-system.php | 8 ++++--- server/controllers/system/get-api-keys.php | 6 +++-- server/controllers/system/get-logs.php | 9 +++---- .../controllers/system/get-mail-templates.php | 6 +++-- server/controllers/system/get-settings.php | 6 ++--- server/controllers/system/get-stats.php | 12 +++++----- server/controllers/system/init-admin.php | 13 +++++----- .../system/recover-mail-template.php | 9 +++---- .../ticket/add-custom-response.php | 3 +-- .../controllers/ticket/change-department.php | 11 +++++---- server/controllers/ticket/change-priority.php | 11 +++++---- server/controllers/ticket/check.php | 13 +++++----- server/controllers/ticket/close.php | 9 +++---- server/controllers/ticket/comment.php | 14 +++++------ server/controllers/ticket/create.php | 24 +++++++++---------- .../ticket/delete-custom-response.php | 9 +++---- .../ticket/edit-custom-response.php | 16 ++++++------- .../ticket/get-custom-responses.php | 5 ++-- server/controllers/ticket/get.php | 12 +++++----- server/controllers/ticket/re-open.php | 9 +++---- server/controllers/ticket/seen.php | 5 ++-- server/controllers/user/ban.php | 4 +++- server/controllers/user/check-session.php | 4 +--- server/controllers/user/delete.php | 8 ++++--- server/controllers/user/edit-email.php | 11 +++++---- server/controllers/user/edit-password.php | 13 +++++----- server/controllers/user/get-user.php | 12 ++++++---- server/controllers/user/get-users.php | 22 ++++++++--------- server/controllers/user/get.php | 9 +++---- server/controllers/user/list-ban.php | 8 ++++--- server/controllers/user/login.php | 24 +++++++++---------- server/controllers/user/logout.php | 4 ++-- server/controllers/user/recover-password.php | 17 ++++++------- .../user/send-recover-password.php | 12 ++++++---- server/controllers/user/signup.php | 24 +++++++++++-------- server/controllers/user/un-ban.php | 9 +++---- server/controllers/user/verify.php | 11 +++++---- server/models/Topic.php | 9 +++++++ 71 files changed, 394 insertions(+), 331 deletions(-) diff --git a/server/controllers/article/add-topic.php b/server/controllers/article/add-topic.php index 796a81b0..64065e53 100644 --- a/server/controllers/article/add-topic.php +++ b/server/controllers/article/add-topic.php @@ -14,12 +14,11 @@ DataValidator::with('CustomValidations', true); * @apiPermission Staff level 2 * * @apiParam {String} name Name of the new topic. + * @apiParam {String} icon Icon of the new topic. + * @apiParam {String} iconColor Icon's color of the new topic. * - * @apiParam {string} icon Icon of the new topic. - * - * @apiParam {string} iconColor Icon's color of the new topic. - * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_NAME * * @apiSuccess {Object} data * diff --git a/server/controllers/article/add.php b/server/controllers/article/add.php index 296e81c9..19439e11 100644 --- a/server/controllers/article/add.php +++ b/server/controllers/article/add.php @@ -14,14 +14,14 @@ DataValidator::with('CustomValidations', true); * @apiPermission Staff level 2 * * @apiParam {String} title Title of the new article. + * @apiParam {String} content Content of the new article. + * @apiParam {Number} position Position of the new article. + * @apiParam {Number} topicId Id of the articles's topic. * - * @apiParam {string} content Content of the new article. - * - * @apiParam {number} position Position of the new article. - * - * @apiParam {number} topicId Id of the articles's topic. - * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_NAME + * @apiUse INVALID_CONTENT + * @apiUse INVALID_TOPIC * * @apiSuccess {Object} data * diff --git a/server/controllers/article/delete-topic.php b/server/controllers/article/delete-topic.php index a754980f..18bbe396 100644 --- a/server/controllers/article/delete-topic.php +++ b/server/controllers/article/delete-topic.php @@ -13,11 +13,12 @@ DataValidator::with('CustomValidations', true); * * @apiPermission Staff level 2 * - * @apiParam {number} topicId Id of the topic. + * @apiParam {Number} topicId Id of the topic. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_TOPIC * - * @apiSuccess {Object} data + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/article/delete.php b/server/controllers/article/delete.php index bc418c31..49afe4e1 100644 --- a/server/controllers/article/delete.php +++ b/server/controllers/article/delete.php @@ -13,11 +13,12 @@ DataValidator::with('CustomValidations', true); * * @apiPermission Staff level 2 * - * @apiParam {number} articleId Id of the article. + * @apiParam {Number} articleId Id of the article. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_TOPIC * - * @apiSuccess {Object} data + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/article/edit-topic.php b/server/controllers/article/edit-topic.php index 3e4f4b8b..32369ab6 100644 --- a/server/controllers/article/edit-topic.php +++ b/server/controllers/article/edit-topic.php @@ -13,17 +13,15 @@ DataValidator::with('CustomValidations', true); * * @apiPermission Staff level 2 * - * @apiParam {number} topicId Id of the topic. - * + * @apiParam {Number} topicId Id of the topic. * @apiParam {String} name The new name of the topic. + * @apiParam {String} icon The new icon of the topic. + * @apiParam {String} iconColor The new Icon's color of the topic. * - * @apiParam {string} icon The new icon of the topic. + * @apiUse NO_PERMISSION + * @apiUse INVALID_TOPIC * - * @apiParam {string} iconColor The new Icon's color of the topic. - * - * @apiError {String} message - * - * @apiSuccess {Object} data + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/article/edit.php b/server/controllers/article/edit.php index 7386916c..c33ca008 100644 --- a/server/controllers/article/edit.php +++ b/server/controllers/article/edit.php @@ -13,19 +13,16 @@ DataValidator::with('CustomValidations', true); * * @apiPermission Staff level 2 * - * @apiParam {number} articleId Id of the article. + * @apiParam {Number} articleId Id of the article. + * @apiParam {Number} topicId Id of the topic of the article. + * @apiParam {String} content The new content of the article. + * @apiParam {String} title The new title of the article. + * @apiParam {Number} position The new position of the article. + * + * @apiUse NO_PERMISSION + * @apiUse INVALID_TOPIC * - * @apiParam {number} topicId Id of the topic of the article. - * - * @apiParam {string} content The new content of the article. - * - * @apiParam {string} title The new title of the article. - * - * @apiParam {number} position The new position of the article. - * - * @apiError {String} message - * - * @apiSuccess {Object} data + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/article/get-all.php b/server/controllers/article/get-all.php index 2b3781a2..35e49357 100644 --- a/server/controllers/article/get-all.php +++ b/server/controllers/article/get-all.php @@ -3,16 +3,18 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/get-all Get all articles. + * @api {post} /article/get-all Retrieve all articles. * * @apiName Get all * * @apiGroup article * - * @apiDescription This path give back all the articles. + * @apiDescription This path retrieves all the articles. * - * @apiPermission any + * @apiPermission any or user * + * @apiUse NO_PERMISSION + * * @apiSuccess {Object} data * */ diff --git a/server/controllers/staff/add.php b/server/controllers/staff/add.php index 035a0167..cd809879 100644 --- a/server/controllers/staff/add.php +++ b/server/controllers/staff/add.php @@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /staff/add Add a new staff member. + * @api {post} /staff/add Add a new staff member. * * @apiName Add * @@ -14,18 +14,18 @@ DataValidator::with('CustomValidations', true); * @apiPermission Staff level 3 * * @apiParam {String} name The name of the new staff member. - * * @apiParam {String} email The email of the new staff member. - * * @apiParam {String} password The password of the new staff member. - * - * @apiParam {number} level The level of the new staff member. + * @apiParam {Number} level The level of the new staff member. + * @apiParam {String} profilePic The profile pic of the new staff member. + * @apiParam {String} departments The departments that will have assigned the new staff member. * - * @apiParam {string} profilePic The profile pic of the new staff member. - * - * @apiParam {string} departments The departments that will have assigned the new staff member. - * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_NAME + * @apiUse INVALID_EMAIL + * @apiUse INVALID_PASSWORD + * @apiUse INVALID_LEVEL + * @apiUse ALREADY_A_STAFF * * @apiSuccess {Object} data * diff --git a/server/controllers/staff/assign-ticket.php b/server/controllers/staff/assign-ticket.php index d106ae4f..9a84e73e 100644 --- a/server/controllers/staff/assign-ticket.php +++ b/server/controllers/staff/assign-ticket.php @@ -13,11 +13,14 @@ DataValidator::with('CustomValidations', true); * * @apiPermission Staff level 1 * - * @apiParam {number} ticketNumber The number of the ticket to assign. + * @apiParam {Number} ticketNumber The number of the ticket to assign. * - * @apiError {string} message - * - * @apiSuccess {Object} data + * @apiUse NO_PERMISSION + * @apiUse INVALID_TICKET + * @apiUse TICKET_ALREADY_ASSIGNED + * @apiUse INVALID_DEPARTMENT + * + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/staff/delete.php b/server/controllers/staff/delete.php index b51cd3b7..cf9445fd 100644 --- a/server/controllers/staff/delete.php +++ b/server/controllers/staff/delete.php @@ -13,11 +13,12 @@ use RedBeanPHP\Facade as RedBean; * * @apiPermission Staff level 3 * - * @apiParam {number} staffId The id of the staff member. + * @apiParam {Number} staffId The id of the staff member. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_STAFF * - * @apiSuccess {Object} data + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/staff/edit.php b/server/controllers/staff/edit.php index 44897e1a..fa476102 100644 --- a/server/controllers/staff/edit.php +++ b/server/controllers/staff/edit.php @@ -2,7 +2,7 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/edit Edit a staff member. + * @api {post} /staff/edit Edit a staff member. * * @apiName Edit * @@ -12,19 +12,16 @@ use Respect\Validation\Validator as DataValidator; * * @apiPermission Staff level 1 * - * @apiParam {number} staffId Id of the staff. - * + * @apiParam {Number} staffId Id of the staff. * @apiParam {String} departments The name of the departments to change. - * * @apiParam {String} email The new email of the staff member. - * * @apiParam {String} password The new password of the staff member. - * - * @apiParam {number} level The new level of the staff member. + * @apiParam {Number} level The new level of the staff member. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_STAFF * - * @apiSuccess {Object} data + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/staff/get-all-tickets.php b/server/controllers/staff/get-all-tickets.php index f649d26c..90956f21 100644 --- a/server/controllers/staff/get-all-tickets.php +++ b/server/controllers/staff/get-all-tickets.php @@ -2,19 +2,20 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-all-tickets Give back all tickets. + * @api {post} /staff/get-all-tickets Retrieve all tickets. * * @apiName Get all tickets * * @apiGroup staff * - * @apiDescription This path give back all tickets created. + * @apiDescription This path retrieves all tickets created. * * @apiPermission Staff level 1 * - * @apiParam {number} page The page's number that it's looking for. + * @apiParam {Number} page The page's number that it's looking for. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_PAGE * * @apiSuccess {Object} data * diff --git a/server/controllers/staff/get-all.php b/server/controllers/staff/get-all.php index 62b0fdb1..ce656906 100644 --- a/server/controllers/staff/get-all.php +++ b/server/controllers/staff/get-all.php @@ -2,15 +2,17 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-all Get information about all the staff members. + * @api {post} /staff/get-all Retrieve information about all the staff members. * * @apiName Get all * * @apiGroup staff * - * @apiDescription This path give back information about all the staff member. + * @apiDescription This path retrieves information about all the staff member. * * @apiPermission Staff level 3 + * + * @apiUse NO_PERMISSION * * @apiSuccess {Object} data * diff --git a/server/controllers/staff/get-new-tickets.php b/server/controllers/staff/get-new-tickets.php index b18242b6..e36ba3eb 100644 --- a/server/controllers/staff/get-new-tickets.php +++ b/server/controllers/staff/get-new-tickets.php @@ -3,16 +3,18 @@ use RedBeanPHP\Facade as RedBean; use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-new-tickets Get new tickets. + * @api {post} /staff/get-new-tickets Retrieve new tickets. * * @apiName Get new tickets * * @apiGroup staff * - * @apiDescription This path give back new tickets. + * @apiDescription This path retrieves new tickets. * * @apiPermission Staff level 1 * + * @apiUse NO_PERMISSION + * * @apiSuccess {Object} data * */ diff --git a/server/controllers/staff/get-tickets.php b/server/controllers/staff/get-tickets.php index 940127f8..352bca6a 100644 --- a/server/controllers/staff/get-tickets.php +++ b/server/controllers/staff/get-tickets.php @@ -2,16 +2,18 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-tickets Get own tickets. + * @api {post} /staff/get-tickets Retrieve own tickets. * * @apiName Get tickets * * @apiGroup staff * - * @apiDescription This path give back the tickets of current staff member. + * @apiDescription This path retrieves the tickets of current staff member. * * @apiPermission Staff level 1 * + * @apiUse NO_PERMISSION + * * @apiSuccess {Object} data * */ diff --git a/server/controllers/staff/get.php b/server/controllers/staff/get.php index 2416488b..e42eee21 100644 --- a/server/controllers/staff/get.php +++ b/server/controllers/staff/get.php @@ -3,19 +3,19 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /staff/get Get information about a staff member. + * @api {post} /staff/get Retrieve information about a staff member. * * @apiName Get * * @apiGroup staff * - * @apiDescription This path give back information about a staff member . + * @apiDescription This path retrieves information about a staff member . * * @apiPermission Staff level 1 * - * @apiParam {number} staffId The id of the staff member searched. + * @apiParam {Number} staffId The id of the staff member searched. * - * @apiError {String} message + * @apiUse NO_PERMISSION * * @apiSuccess {Object} data * diff --git a/server/controllers/staff/last-events.php b/server/controllers/staff/last-events.php index 59e089e1..6652b8b2 100644 --- a/server/controllers/staff/last-events.php +++ b/server/controllers/staff/last-events.php @@ -2,19 +2,20 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/last-events Give back the last events. + * @api {post} /staff/last-events Retrieve the last events. * * @apiName Last events * * @apiGroup staff * - * @apiDescription This path give back the last events. + * @apiDescription This path retrieves the last events. * * @apiPermission Staff level 1 * - * @apiParam {number} page The page's number of the list. + * @apiParam {Number} page The page's number of the list. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_PAGE * * @apiSuccess {Object} data * diff --git a/server/controllers/staff/search-tickets.php b/server/controllers/staff/search-tickets.php index 628e3f7f..c6c166df 100644 --- a/server/controllers/staff/search-tickets.php +++ b/server/controllers/staff/search-tickets.php @@ -2,7 +2,7 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/search-tickets Search some tickets. + * @api {post} /staff/search-tickets Search some tickets. * * @apiName Search tickets * @@ -12,11 +12,12 @@ use Respect\Validation\Validator as DataValidator; * * @apiPermission Staff level 1 * - * @apiParam {String} query key to search. + * @apiParam {String} query Key to search. + * @apiParam {Number} page The number of page. * - * @apiParam {number} page The number of page. - * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_QUERY + * @apiUse INVALID_PAGE * * @apiSuccess {Object} data * diff --git a/server/controllers/staff/un-assign-ticket.php b/server/controllers/staff/un-assign-ticket.php index 8471cf27..cadc3cbd 100644 --- a/server/controllers/staff/un-assign-ticket.php +++ b/server/controllers/staff/un-assign-ticket.php @@ -3,7 +3,7 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /staff/un-assign-ticket Un-assign a ticket. + * @api {post} /staff/un-assign-ticket Un-assign a ticket. * * @apiName Un-assign ticket * @@ -13,11 +13,12 @@ DataValidator::with('CustomValidations', true); * * @apiPermission Staff level 1 * - * @apiParam {number} ticketNumber Ticket number to un-assign. + * @apiParam {Number} ticketNumber Ticket number to un-assign. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_TICKET * - * @apiSuccess {Object} data + * @apiSuccess {Object} data Empty object * */ diff --git a/server/controllers/system/add-api-key.php b/server/controllers/system/add-api-key.php index c943aba4..26e2d966 100644 --- a/server/controllers/system/add-api-key.php +++ b/server/controllers/system/add-api-key.php @@ -12,9 +12,11 @@ use Respect\Validation\Validator as DataValidator; * * @apiPermission Staff level 3 * - * @apiParam {string} name Number of the new api-key. + * @apiParam {String} name Name of the new api-key. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_NAME + * @apiUse NAME_ALREADY_USED * * @apiSuccess {Object} data * diff --git a/server/controllers/system/add-department.php b/server/controllers/system/add-department.php index aab91e6e..9bdfbaea 100644 --- a/server/controllers/system/add-department.php +++ b/server/controllers/system/add-department.php @@ -12,9 +12,10 @@ use Respect\Validation\Validator as DataValidator; * * @apiPermission Staff level 3 * - * @apiParam {string} name Number of the new department. + * @apiParam {String} name Name of the new department. * - * @apiError {String} message + * @apiUse NO_PERMISSION + * @apiUse INVALID_NAME * * @apiSuccess {Object} data * diff --git a/server/controllers/system/backup-database.php b/server/controllers/system/backup-database.php index 709e23f3..0e10a7e9 100644 --- a/server/controllers/system/backup-database.php +++ b/server/controllers/system/backup-database.php @@ -12,7 +12,7 @@ use Ifsnop\Mysqldump as IMysqldump; * * @apiPermission Staff level 3 * - * @apiSuccess {Object} data + * @apiUse NO_PERMISSION * */ diff --git a/server/controllers/system/check-requirements.php b/server/controllers/system/check-requirements.php index 2de68b7c..6dcd587d 100644 --- a/server/controllers/system/check-requirements.php +++ b/server/controllers/system/check-requirements.php @@ -1,13 +1,13 @@