diff --git a/server/API_STANDARD.md b/server/API_STANDARD.md index 29b94a79..d7ebb5d5 100644 --- a/server/API_STANDARD.md +++ b/server/API_STANDARD.md @@ -35,4 +35,6 @@ This request will return you the session data with an `userId` and a `token`. Yo **All the paths that have permission `user`, `staff1`, `staff2` or `staff3`, require *userId* and *token* to be passed as parameter**. You need to pass them as `csrf_userid` and `csrf_token` respectively. -If you don't pass the userId and token, a `NO_PERMISSION` error will be returned. \ No newline at end of file +If you don't pass the userId and token, a `NO_PERMISSION` error will be returned. + +Additionally, if there is no users (only staff members), you can check a ticket you created by providing your email and the ticketNumber to the `/ticket/check` path. This path will return you a `token` and `ticketNumber` you will use to comment, retrieve, or do any other operations to the ticket. diff --git a/server/controllers/article/add-topic.php b/server/controllers/article/add-topic.php index b5abee2e..5b30bf77 100755 --- a/server/controllers/article/add-topic.php +++ b/server/controllers/article/add-topic.php @@ -3,15 +3,16 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/add-topic Add a new topic. + * @api {post} /article/add-topic Add topic + * @apiVersion 4.0.0 * * @apiName Add topic * - * @apiGroup article + * @apiGroup Article * * @apiDescription This path adds a new topic. * - * @apiPermission Staff level 2 + * @apiPermission staff2 * * @apiParam {String} name Name of the new topic. * @apiParam {String} icon Icon of the new topic. diff --git a/server/controllers/article/add.php b/server/controllers/article/add.php index 9addb9dc..2f1b250a 100755 --- a/server/controllers/article/add.php +++ b/server/controllers/article/add.php @@ -3,15 +3,16 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/add Add a article. + * @api {post} /article/add Add article + * @apiVersion 4.0.0 * - * @apiName Add + * @apiName Add article * - * @apiGroup article + * @apiGroup Article * * @apiDescription This path adds a new article. * - * @apiPermission Staff level 2 + * @apiPermission staff2 * * @apiParam {String} title Title of the new article. * @apiParam {String} content Content of the new article. diff --git a/server/controllers/article/delete-topic.php b/server/controllers/article/delete-topic.php index 18bbe396..18bd628d 100755 --- a/server/controllers/article/delete-topic.php +++ b/server/controllers/article/delete-topic.php @@ -3,15 +3,16 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/delete-topic Delete a topic. + * @api {post} /article/delete-topic Delete topic + * @apiVersion 4.0.0 * * @apiName Delete topic * - * @apiGroup article + * @apiGroup Article * * @apiDescription This path deletes a topic. * - * @apiPermission Staff level 2 + * @apiPermission staff2 * * @apiParam {Number} topicId Id of the topic. * diff --git a/server/controllers/article/delete.php b/server/controllers/article/delete.php index 49afe4e1..948a37b0 100755 --- a/server/controllers/article/delete.php +++ b/server/controllers/article/delete.php @@ -3,15 +3,16 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/delete Delete a article. + * @api {post} /article/delete Delete article + * @apiVersion 4.0.0 * - * @apiName Delete + * @apiName Delete article * - * @apiGroup article + * @apiGroup Article * - * @apiDescription This path deletes a article. + * @apiDescription This path deletes an article. * - * @apiPermission Staff level 2 + * @apiPermission staff2 * * @apiParam {Number} articleId Id of the article. * diff --git a/server/controllers/article/edit-topic.php b/server/controllers/article/edit-topic.php index 32369ab6..88468014 100755 --- a/server/controllers/article/edit-topic.php +++ b/server/controllers/article/edit-topic.php @@ -3,20 +3,21 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/edit-topic Edit a topic. + * @api {post} /article/edit-topic Edit topic + * @apiVersion 4.0.0 * * @apiName Edit topic * - * @apiGroup article + * @apiGroup Article * * @apiDescription This path edits a topic. * - * @apiPermission Staff level 2 + * @apiPermission staff2 * * @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} name The new name of the topic. Optional. + * @apiParam {String} icon The new icon of the topic. Optional. + * @apiParam {String} iconColor The new Icon's color of the topic. Optional. * * @apiUse NO_PERMISSION * @apiUse INVALID_TOPIC diff --git a/server/controllers/article/edit.php b/server/controllers/article/edit.php index c33ca008..d5d76109 100755 --- a/server/controllers/article/edit.php +++ b/server/controllers/article/edit.php @@ -3,21 +3,22 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/edit Edit a article. + * @api {post} /article/edit Edit article + * @apiVersion 4.0.0 * * @apiName Edit a article * - * @apiGroup article + * @apiGroup Article * - * @apiDescription This path edits a article. + * @apiDescription This path edits an article. * - * @apiPermission Staff level 2 + * @apiPermission staff2 * * @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. + * @apiParam {Number} topicId Id of the topic of the article. Optional. + * @apiParam {String} content The new content of the article. Optional. + * @apiParam {String} title The new title of the article. Optional. + * @apiParam {Number} position The new position of the article. Optional. * * @apiUse NO_PERMISSION * @apiUse INVALID_TOPIC diff --git a/server/controllers/article/get-all.php b/server/controllers/article/get-all.php index a2031c1e..59e5fd42 100755 --- a/server/controllers/article/get-all.php +++ b/server/controllers/article/get-all.php @@ -3,11 +3,12 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /article/get-all Retrieve all articles. + * @api {post} /article/get-all Get all articles + * @apiVersion 4.0.0 * - * @apiName Get all + * @apiName Get all articles * - * @apiGroup article + * @apiGroup Article * * @apiDescription This path retrieves all the articles. * diff --git a/server/controllers/staff/add.php b/server/controllers/staff/add.php index 2c4ccc07..eed23198 100755 --- a/server/controllers/staff/add.php +++ b/server/controllers/staff/add.php @@ -3,22 +3,23 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /staff/add Add a new staff member. + * @api {post} /staff/add Add staff + * @apiVersion 4.0.0 * - * @apiName Add + * @apiName Add staff * - * @apiGroup staff + * @apiGroup Staff * - * @apiDescription This path add a new staff member. + * @apiDescription This path adds a new staff member. * - * @apiPermission Staff level 3 + * @apiPermission staff3 * * @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 {String} profilePic The profile pic of the new staff member. - * @apiParam {String} departments The departments that will have assigned the new staff member. + * @apiParam {Number[]} departments The departments that will have assigned the new staff member. * * @apiUse NO_PERMISSION * @apiUse INVALID_NAME diff --git a/server/controllers/staff/assign-ticket.php b/server/controllers/staff/assign-ticket.php index 9a84e73e..ffab05c5 100755 --- a/server/controllers/staff/assign-ticket.php +++ b/server/controllers/staff/assign-ticket.php @@ -3,15 +3,16 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /staff/assign-ticket Assign a ticket to a staff member. + * @api {post} /staff/assign-ticket Assign ticket + * @apiVersion 4.0.0 * * @apiName Assign ticket * - * @apiGroup staff + * @apiGroup Staff * * @apiDescription This path assigns a ticket to a staff member. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * * @apiParam {Number} ticketNumber The number of the ticket to assign. * diff --git a/server/controllers/staff/delete.php b/server/controllers/staff/delete.php index cf9445fd..3fcadee9 100755 --- a/server/controllers/staff/delete.php +++ b/server/controllers/staff/delete.php @@ -3,15 +3,16 @@ use Respect\Validation\Validator as DataValidator; use RedBeanPHP\Facade as RedBean; /** - * @api {post} /staff/delete Delete a staff member. + * @api {post} /staff/delete Delete staff + * @apiVersion 4.0.0 * - * @apiName Delete + * @apiName Delete staff * - * @apiGroup staff + * @apiGroup Staff * * @apiDescription This path deletes a staff member. * - * @apiPermission Staff level 3 + * @apiPermission staff3 * * @apiParam {Number} staffId The id of the staff member. * diff --git a/server/controllers/staff/edit.php b/server/controllers/staff/edit.php index fa476102..ac7ab89f 100755 --- a/server/controllers/staff/edit.php +++ b/server/controllers/staff/edit.php @@ -2,21 +2,22 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/edit Edit a staff member. + * @api {post} /staff/edit Edit staff + * @apiVersion 4.0.0 * - * @apiName Edit + * @apiName Edit staff * - * @apiGroup staff + * @apiGroup Staff * - * @apiDescription This path edits a staff member . + * @apiDescription This path edits a staff member. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * * @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 {String} departments The name of the departments to change. Optional. + * @apiParam {String} email The new email of the staff member. Optional. + * @apiParam {String} password The new password of the staff member. Optional. + * @apiParam {Number} level The new level of the staff member. Optional. * * @apiUse NO_PERMISSION * @apiUse INVALID_STAFF diff --git a/server/controllers/staff/get-all-tickets.php b/server/controllers/staff/get-all-tickets.php index 8cf367ac..c4b8f170 100755 --- a/server/controllers/staff/get-all-tickets.php +++ b/server/controllers/staff/get-all-tickets.php @@ -2,24 +2,25 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-all-tickets Retrieve all tickets. + * @api {post} /staff/get-all-tickets Get all tickets + * @apiVersion 4.0.0 * * @apiName Get all tickets * - * @apiGroup staff + * @apiGroup Staff * - * @apiDescription This path retrieves all tickets created. + * @apiDescription This path retrieves all tickets. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * - * @apiParam {Number} page The page's number that it's looking for. + * @apiParam {Number} page The page number. * * @apiUse NO_PERMISSION * @apiUse INVALID_PAGE * - * @apiSuccess {Object} data Information about a tickets and quantity of pages - * @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data.tickets Array of tickets of the current page - * @apiSuccess {Number} data.pages Quantity of pages + * @apiSuccess {Object} data Information about a tickets and quantity of pages. + * @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data.tickets Array of tickets of the current page. + * @apiSuccess {Number} data.pages Quantity of pages. * */ diff --git a/server/controllers/staff/get-all.php b/server/controllers/staff/get-all.php index 9ea663aa..f0b021e4 100755 --- a/server/controllers/staff/get-all.php +++ b/server/controllers/staff/get-all.php @@ -2,15 +2,16 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-all Retrieve information about all the staff members. + * @api {post} /staff/get-all Get all staffs + * @apiVersion 4.0.0 * - * @apiName Get all + * @apiName Get all staffs * - * @apiGroup staff + * @apiGroup Staff * * @apiDescription This path retrieves information about all the staff member. * - * @apiPermission Staff level 3 + * @apiPermission staff3 * * @apiUse NO_PERMISSION * diff --git a/server/controllers/staff/get-new-tickets.php b/server/controllers/staff/get-new-tickets.php index ddfb439a..c469a0ff 100755 --- a/server/controllers/staff/get-new-tickets.php +++ b/server/controllers/staff/get-new-tickets.php @@ -3,19 +3,20 @@ use RedBeanPHP\Facade as RedBean; use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-new-tickets Retrieve new tickets. + * @api {post} /staff/get-new-tickets Get new tickets + * @apiVersion 4.0.0 * * @apiName Get new tickets * - * @apiGroup staff + * @apiGroup Staff * - * @apiDescription This path retrieves new tickets. + * @apiDescription This path retrieves the new tickets of the departments the staff has assigned. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * * @apiUse NO_PERMISSION * - * @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data Array of new tickets + * @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data Array of new tickets. * */ diff --git a/server/controllers/staff/get-tickets.php b/server/controllers/staff/get-tickets.php index 03b42950..fdb2335c 100755 --- a/server/controllers/staff/get-tickets.php +++ b/server/controllers/staff/get-tickets.php @@ -2,15 +2,16 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/get-tickets Retrieve own tickets. + * @api {post} /staff/get-tickets Get tickets + * @apiVersion 4.0.0 * * @apiName Get tickets * - * @apiGroup staff + * @apiGroup Staff * - * @apiDescription This path retrieves the tickets of current staff member. + * @apiDescription This path retrieves the tickets assigned to the current staff member. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * * @apiUse NO_PERMISSION * diff --git a/server/controllers/staff/get.php b/server/controllers/staff/get.php index a0737992..90de8990 100755 --- a/server/controllers/staff/get.php +++ b/server/controllers/staff/get.php @@ -3,17 +3,18 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); /** - * @api {post} /staff/get Retrieve information about a staff member. + * @api {post} /staff/get Get staff + * @apiVersion 4.0.0 * - * @apiName Get + * @apiName Get staff * - * @apiGroup staff + * @apiGroup Staff * - * @apiDescription This path retrieves information about a staff member . + * @apiDescription This path retrieves information about a staff member. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * - * @apiParam {Number} staffId The id of the staff member searched. + * @apiParam {Number} staffId The id of the staff member to be searched. * * @apiUse NO_PERMISSION * diff --git a/server/controllers/staff/last-events.php b/server/controllers/staff/last-events.php index b166bd5d..27bcc172 100755 --- a/server/controllers/staff/last-events.php +++ b/server/controllers/staff/last-events.php @@ -2,17 +2,18 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/last-events Retrieve the last events. + * @api {post} /staff/last-events Get last events + * @apiVersion 4.0.0 * - * @apiName Last events + * @apiName Get last events * - * @apiGroup staff + * @apiGroup Staff * * @apiDescription This path retrieves the last events. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * - * @apiParam {Number} page The page's number of the list. + * @apiParam {Number} page The page number. * * @apiUse NO_PERMISSION * @apiUse INVALID_PAGE diff --git a/server/controllers/staff/search-tickets.php b/server/controllers/staff/search-tickets.php index 7c3e5a72..7f2f08a9 100755 --- a/server/controllers/staff/search-tickets.php +++ b/server/controllers/staff/search-tickets.php @@ -2,18 +2,19 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /staff/search-tickets Search some tickets. + * @api {post} /staff/search-tickets Search tickets + * @apiVersion 4.0.0 * * @apiName Search tickets * - * @apiGroup staff + * @apiGroup Staff * * @apiDescription This path search some tickets. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * - * @apiParam {String} query Key to search. - * @apiParam {Number} page The number of page. + * @apiParam {String} query Query string to search. + * @apiParam {Number} page The page number. * * @apiUse NO_PERMISSION * @apiUse INVALID_QUERY @@ -21,7 +22,7 @@ use Respect\Validation\Validator as DataValidator; * * @apiSuccess {Object} data Information about tickets * @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data.tickets Array of tickets found - * @apiSuccess {Number} data.pages Number of the page + * @apiSuccess {Number} data.pages Number of pages * */ diff --git a/server/controllers/staff/un-assign-ticket.php b/server/controllers/staff/un-assign-ticket.php index cadc3cbd..09cb8112 100755 --- a/server/controllers/staff/un-assign-ticket.php +++ b/server/controllers/staff/un-assign-ticket.php @@ -3,15 +3,16 @@ 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 ticket + * @apiVersion 4.0.0 * * @apiName Un-assign ticket * - * @apiGroup staff + * @apiGroup Staff * - * @apiDescription This path un assign a ticket of a staff member. + * @apiDescription This path un-assigns a ticket to the current staff member. * - * @apiPermission Staff level 1 + * @apiPermission staff1 * * @apiParam {Number} ticketNumber Ticket number to un-assign. * diff --git a/server/controllers/system/add-api-key.php b/server/controllers/system/add-api-key.php index 88732751..40bdc307 100755 --- a/server/controllers/system/add-api-key.php +++ b/server/controllers/system/add-api-key.php @@ -2,23 +2,24 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /system/add-api-key Create a new api-key. + * @api {post} /system/add-api-key Add APIKey + * @apiVersion 4.0.0 * - * @apiName Add api-key + * @apiName Add APIKey * - * @apiGroup system + * @apiGroup System * - * @apiDescription This path create a new api-key. + * @apiDescription This path creates a new APIKey. * - * @apiPermission Staff level 3 + * @apiPermission staff3 * - * @apiParam {String} name Name of the new api-key. + * @apiParam {String} name Name of the new APIKey. * * @apiUse NO_PERMISSION * @apiUse INVALID_NAME * @apiUse NAME_ALREADY_USED * - * @apiSuccess {String} data Token of the api key + * @apiSuccess {String} data Token of the APIKey. * */ diff --git a/server/controllers/system/add-department.php b/server/controllers/system/add-department.php index 47a10fc8..b042d4c5 100755 --- a/server/controllers/system/add-department.php +++ b/server/controllers/system/add-department.php @@ -2,15 +2,16 @@ use Respect\Validation\Validator as DataValidator; /** - * @api {post} /system/add-department Create a new department. + * @api {post} /system/add-department Add department + * @apiVersion 4.0.0 * * @apiName Add department * - * @apiGroup system + * @apiGroup System * * @apiDescription This path create a new department. * - * @apiPermission Staff level 3 + * @apiPermission staff3 * * @apiParam {String} name Name of the new department. * diff --git a/server/controllers/system/backup-database.php b/server/controllers/system/backup-database.php index 80f03546..3fe9d2fd 100755 --- a/server/controllers/system/backup-database.php +++ b/server/controllers/system/backup-database.php @@ -2,15 +2,16 @@ use Ifsnop\Mysqldump as IMysqldump; /** - * @api {post} /system/backup-database Do a backup of the database. + * @api {post} /system/backup-database Backup database + * @apiVersion 4.0.0 * * @apiName Backup database * - * @apiGroup system + * @apiGroup System * - * @apiDescription This path do a backup of the database. + * @apiDescription This path does a backup of the database. * - * @apiPermission Staff level 3 + * @apiPermission staff3 * * @apiUse NO_PERMISSION * diff --git a/server/controllers/system/check-requirements.php b/server/controllers/system/check-requirements.php index 6dcd587d..c9b9ada1 100755 --- a/server/controllers/system/check-requirements.php +++ b/server/controllers/system/check-requirements.php @@ -1,13 +1,14 @@