Merge branch 'DataAPI'

This commit is contained in:
AntonyAntonio 2017-04-21 22:41:29 -03:00
commit 7a6eccb1bd
84 changed files with 1809 additions and 0 deletions

View File

@ -2,6 +2,29 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/add-topic Add a new topic.
*
* @apiName Add topic
*
* @apiGroup article
*
* @apiDescription This path adds a new topic.
*
* @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.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
*
* @apiSuccess {Object} data Topic info
* @apiSuccess {Number} data.topicId Topic id
*
*/
class AddTopicController extends Controller {
const PATH = '/add-topic';
const METHOD = 'POST';

View File

@ -2,6 +2,31 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/add Add a article.
*
* @apiName Add
*
* @apiGroup article
*
* @apiDescription This path adds a new article.
*
* @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.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
* @apiUse INVALID_CONTENT
* @apiUse INVALID_TOPIC
*
* @apiSuccess {Object} data Article info
* @apiSuccess {Number} data.articleId Article id
*/
class AddArticleController extends Controller {
const PATH = '/add';
const METHOD = 'POST';

View File

@ -2,6 +2,26 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/delete-topic Delete a topic.
*
* @apiName Delete topic
*
* @apiGroup article
*
* @apiDescription This path deletes a topic.
*
* @apiPermission Staff level 2
*
* @apiParam {Number} topicId Id of the topic.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TOPIC
*
* @apiSuccess {Object} data Empty object
*
*/
class DeleteTopicController extends Controller {
const PATH = '/delete-topic';
const METHOD = 'POST';

View File

@ -2,6 +2,26 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/delete Delete a article.
*
* @apiName Delete
*
* @apiGroup article
*
* @apiDescription This path deletes a article.
*
* @apiPermission Staff level 2
*
* @apiParam {Number} articleId Id of the article.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TOPIC
*
* @apiSuccess {Object} data Empty object
*
*/
class DeleteArticleController extends Controller {
const PATH = '/delete';
const METHOD = 'POST';

View File

@ -2,6 +2,29 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/edit-topic Edit a topic.
*
* @apiName Edit topic
*
* @apiGroup article
*
* @apiDescription This path edits a topic.
*
* @apiPermission Staff level 2
*
* @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.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TOPIC
*
* @apiSuccess {Object} data Empty object
*
*/
class EditTopicController extends Controller {
const PATH = '/edit-topic';
const METHOD = 'POST';

View File

@ -2,6 +2,30 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/edit Edit a article.
*
* @apiName Edit a article
*
* @apiGroup article
*
* @apiDescription This path edits a article.
*
* @apiPermission Staff level 2
*
* @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
*
* @apiSuccess {Object} data Empty object
*
*/
class EditArticleController extends Controller {
const PATH = '/edit';
const METHOD = 'POST';

View File

@ -2,6 +2,22 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /article/get-all Retrieve all articles.
*
* @apiName Get all
*
* @apiGroup article
*
* @apiDescription This path retrieves all the articles.
*
* @apiPermission any or user
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[Topic](#api-Data_Structures-ObjectTopic)[]} data Array of topics.
*/
class GetAllArticlesController extends Controller {
const PATH = '/get-all';
const METHOD = 'POST';

View File

@ -2,6 +2,36 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/add Add a new staff member.
*
* @apiName Add
*
* @apiGroup staff
*
* @apiDescription This path add a new staff member.
*
* @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 {String} profilePic The profile pic of the new staff member.
* @apiParam {String} departments The departments that will have assigned the new staff member.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
* @apiUse INVALID_EMAIL
* @apiUse INVALID_PASSWORD
* @apiUse INVALID_LEVEL
* @apiUse ALREADY_A_STAFF
*
* @apiSuccess {Object} data Staff info object
* @apiSuccess {Number} data.id Staff id
*
*/
class AddStaffController extends Controller {
const PATH = '/add';
const METHOD = 'POST';

View File

@ -2,6 +2,28 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/assign-ticket Assign a ticket to a staff member.
*
* @apiName Assign ticket
*
* @apiGroup staff
*
* @apiDescription This path assigns a ticket to a staff member.
*
* @apiPermission Staff level 1
*
* @apiParam {Number} ticketNumber The number of the ticket to assign.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
* @apiUse TICKET_ALREADY_ASSIGNED
* @apiUse INVALID_DEPARTMENT
*
* @apiSuccess {Object} data Empty object
*
*/
class AssignStaffController extends Controller {
const PATH = '/assign-ticket';
const METHOD = 'POST';

View File

@ -2,6 +2,26 @@
use Respect\Validation\Validator as DataValidator;
use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /staff/delete Delete a staff member.
*
* @apiName Delete
*
* @apiGroup staff
*
* @apiDescription This path deletes a staff member.
*
* @apiPermission Staff level 3
*
* @apiParam {Number} staffId The id of the staff member.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_STAFF
*
* @apiSuccess {Object} data Empty object
*
*/
DataValidator::with('CustomValidations', true);
class DeleteStaffController extends Controller {

View File

@ -1,6 +1,30 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/edit Edit a staff member.
*
* @apiName Edit
*
* @apiGroup staff
*
* @apiDescription This path edits a staff member .
*
* @apiPermission Staff level 1
*
* @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.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_STAFF
*
* @apiSuccess {Object} data Empty object
*
*/
class EditStaffController extends Controller {
const PATH = '/edit';
const METHOD = 'POST';

View File

@ -1,6 +1,28 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-all-tickets Retrieve all tickets.
*
* @apiName Get all tickets
*
* @apiGroup staff
*
* @apiDescription This path retrieves all tickets created.
*
* @apiPermission Staff level 1
*
* @apiParam {Number} page The page's number that it's looking for.
*
* @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
*
*/
class GetAllTicketsStaffController extends Controller {
const PATH = '/get-all-tickets';
const METHOD = 'POST';

View File

@ -1,6 +1,22 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-all Retrieve information about all the staff members.
*
* @apiName Get all
*
* @apiGroup staff
*
* @apiDescription This path retrieves information about all the staff member.
*
* @apiPermission Staff level 3
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[Staff](#api-Data_Structures-ObjectStaff)[]} data Array of staff members.
*
*/
class GetAllStaffController extends Controller {
const PATH ='/get-all';

View File

@ -2,6 +2,23 @@
use RedBeanPHP\Facade as RedBean;
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-new-tickets Retrieve new tickets.
*
* @apiName Get new tickets
*
* @apiGroup staff
*
* @apiDescription This path retrieves new tickets.
*
* @apiPermission Staff level 1
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data Array of new tickets
*
*/
class GetNewTicketsStaffController extends Controller {
const PATH = '/get-new-tickets';
const METHOD = 'POST';

View File

@ -1,6 +1,23 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/get-tickets Retrieve own tickets.
*
* @apiName Get tickets
*
* @apiGroup staff
*
* @apiDescription This path retrieves the tickets of current staff member.
*
* @apiPermission Staff level 1
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data Array of tickets assigned to the staff
*
*/
class GetTicketStaffController extends Controller {
const PATH = '/get-tickets';
const METHOD = 'POST';

View File

@ -2,6 +2,32 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/get Retrieve information about a staff member.
*
* @apiName Get
*
* @apiGroup staff
*
* @apiDescription This path retrieves information about a staff member .
*
* @apiPermission Staff level 1
*
* @apiParam {Number} staffId The id of the staff member searched.
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Information about a staff member
* @apiSuccess {String} data.name Staff id
* @apiSuccess {String} data.email Staff id
* @apiSuccess {String} data.profilePic Staff id
* @apiSuccess {Number} data.level Staff id
* @apiSuccess {Boolean} data.staff Staff id
* @apiSuccess {[Department](#api-Data_Structures-ObjectDepartment)[]} data.departments Array of departments that has assigned.
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data.tickets Array of tickets that has assigned.
*
*/
class GetStaffController extends Controller {
const PATH = '/get';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/last-events Retrieve the last events.
*
* @apiName Last events
*
* @apiGroup staff
*
* @apiDescription This path retrieves the last events.
*
* @apiPermission Staff level 1
*
* @apiParam {Number} page The page's number of the list.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PAGE
*
* @apiSuccess {[TicketEvent](#api-Data_Structures-ObjectTicketevent)[]} data Array of last events
*
*/
class LastEventsStaffController extends Controller {
const PATH = '/last-events';
const METHOD = 'POST';

View File

@ -1,6 +1,30 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /staff/search-tickets Search some tickets.
*
* @apiName Search tickets
*
* @apiGroup staff
*
* @apiDescription This path search some tickets.
*
* @apiPermission Staff level 1
*
* @apiParam {String} query Key to search.
* @apiParam {Number} page The number of page.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_QUERY
* @apiUse INVALID_PAGE
*
* @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
*
*/
class SearchTicketStaffController extends Controller {
const PATH = '/search-tickets';
const METHOD = 'POST';

View File

@ -2,6 +2,26 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /staff/un-assign-ticket Un-assign a ticket.
*
* @apiName Un-assign ticket
*
* @apiGroup staff
*
* @apiDescription This path un assign a ticket of a staff member.
*
* @apiPermission Staff level 1
*
* @apiParam {Number} ticketNumber Ticket number to un-assign.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
*
* @apiSuccess {Object} data Empty object
*
*/
class UnAssignStaffController extends Controller {
const PATH = '/un-assign-ticket';
const METHOD = 'POST';

View File

@ -1,6 +1,27 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/add-api-key Create a new api-key.
*
* @apiName Add api-key
*
* @apiGroup system
*
* @apiDescription This path create a new api-key.
*
* @apiPermission Staff level 3
*
* @apiParam {String} name Name of the new api-key.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
* @apiUse NAME_ALREADY_USED
*
* @apiSuccess {String} data Token of the api key
*
*/
class AddAPIKeyController extends Controller {
const PATH = '/add-api-key';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/add-department Create a new department.
*
* @apiName Add department
*
* @apiGroup system
*
* @apiDescription This path create a new department.
*
* @apiPermission Staff level 3
*
* @apiParam {String} name Name of the new department.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
*
* @apiSuccess {Object} data Empty object
*
*/
class AddDepartmentController extends Controller {
const PATH = '/add-department';
const METHOD = 'POST';

View File

@ -1,6 +1,23 @@
<?php
use Ifsnop\Mysqldump as IMysqldump;
/**
* @api {post} /system/backup-database Do a backup of the database.
*
* @apiName Backup database
*
* @apiGroup system
*
* @apiDescription This path do a backup of the database.
*
* @apiPermission Staff level 3
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {File} file File of the backup
*
*/
class BackupDatabaseController extends Controller {
const PATH = '/backup-database';
const METHOD = 'POST';

View File

@ -1,5 +1,20 @@
<?php
/**
* @api {post} /system/check-requirements Checks and retrieves the current requirements.
*
* @apiName Check requirements
*
* @apiGroup system
*
* @apiDescription This path checks and retrieves the current requirements.
*
* @apiPermission any
*
* @apiSuccess {Object} data
*
*/
class CheckRequirementsController extends Controller {
const PATH = '/check-requirements';
const METHOD = 'POST';

View File

@ -1,5 +1,25 @@
<?php
/**
* @api {post} /system/csv-import Receives a csv file with a list of users to signup .
*
* @apiName CSV import
*
* @apiGroup system
*
* @apiDescription This path receives a csv file with a list of users to signup.
*
* @apiPermission Staff level 3
*
* @apiParam {String} file A csv file with this content format: email,password, name.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_FILE
*
* @apiSuccess {String[]} data Array of errors found
*
*/
class CSVImportController extends Controller {
const PATH = '/csv-import';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /system/delete-all-users Delete all users in database.
*
* @apiName Delete all users
*
* @apiGroup system
*
* @apiDescription This path delete all users in database.
*
* @apiPermission Staff level 3
*
* @apiParam {String} password The password of the current staff.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PASSWORD
*
* @apiSuccess {Object} data Empty object
*
*/
class DeleteAllUsersController extends Controller {
const PATH = '/delete-all-users';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/delete-api-key Delete a api-key.
*
* @apiName Delete api-key
*
* @apiGroup system
*
* @apiDescription This path delete a api-key.
*
* @apiPermission Staff level 3
*
* @apiParam {String} name Name of the api-key to delete.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
*
* @apiSuccess {Object} data Empty object
*
*/
class DeleteAPIKeyController extends Controller {
const PATH = '/delete-api-key';
const METHOD = 'POST';

View File

@ -2,6 +2,28 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /system/delete-department Delete a department.
*
* @apiName Delete department
*
* @apiGroup system
*
* @apiDescription This path delete a department.
*
* @apiPermission Staff level 3
*
* @apiParam {Number} departmentId Id of the department to delete.
* @apiParam {Number} transferDepartmentId Id of the department where the tickets will be transfer to.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_DEPARTMENT
* @apiUse SAME_DEPARTMENT
*
* @apiSuccess {Object} data Empty object
*
*/
class DeleteDepartmentController extends Controller {
const PATH = '/delete-department';
const METHOD = 'POST';

View File

@ -1,5 +1,25 @@
<?php
/**
* @api {post} /system/disable-registration Disable the registration.
*
* @apiName Disable registration
*
* @apiGroup system
*
* @apiDescription This path disable the registration.
*
* @apiPermission Staff level 3
*
* @apiParam {String} password The password of the current staff.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PASSWORD
*
* @apiSuccess {Object} data Empty object
*
*/
class DisableRegistrationController extends Controller {
const PATH = '/disable-registration';
const METHOD = 'POST';

View File

@ -1,5 +1,26 @@
<?php
/**
* @api {post} /system/disable-user-system Disable the user system.
*
* @apiName Disable user system
*
* @apiGroup system
*
* @apiDescription This path disable the user system.
*
* @apiPermission Staff level 3
*
* @apiParam {String} password The password of the current staff.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PASSWORD
* @apiUse SYSTEM_USER_IS_ALREADY_DISABLED
*
* @apiSuccess {Object} data Empty object
*
*/
class DisableUserSystemController extends Controller {
const PATH = '/disable-user-system';
const METHOD = 'POST';

View File

@ -2,6 +2,28 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /system/edit-department Edit a department.
*
* @apiName Edit department
*
* @apiGroup system
*
* @apiDescription This path edit a department created.
*
* @apiPermission Staff level 3
*
* @apiParam {String} name The new name of the department.
*
* @apiParam {Number} departmentId The Id of the department.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
* @apiUse INVALID_DEPARTMENT
*
* @apiSuccess {Object} data Empty object
*
*/
class EditDepartmentController extends Controller {
const PATH = '/edit-department';

View File

@ -1,6 +1,32 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/edit-mail-template Edit a mail template.
*
* @apiName Edit mail template
*
* @apiGroup system
*
* @apiDescription This path edit a mail template.
*
* @apiPermission Staff level 3
*
* @apiParam {String} templateType The new type of the template.
* @apiParam {String} language The new language of the template.
* @apiParam {String} subject The new subject of the template.
* @apiParam {String} body The new content of the template.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TEMPLATE
* @apiUse INVALID_LANGUAGE
* @apiUse INVALID_SUBJECT
* @apiUse INVALID_BODY
*
* @apiSuccess {Object} data Empty object
*
*/
class EditMailTemplateController extends Controller {
const PATH = '/edit-mail-template';
const METHOD = 'POST';

View File

@ -1,5 +1,26 @@
<?php
/**
* @api {post} /system/edit-settings Edit the settings of the system.
*
* @apiName Edit settings
*
* @apiGroup system
*
* @apiDescription This path edit the settings of the system.
*
* @apiPermission Staff level 3
*
* @apiParam {String} allowedLanguages The list of languages allowed.
* @apiParam {String} supportedLanguages The list of languages supported.
* @apiParam {String} settings A list this content format: language, recaptcha-public, recaptcha-private, no-reply-email, smtp-host, smtp-port, smtp-user, smtp-pass, time-zone, maintenance-mode, layout, allow-attachments, max-size, title, url.
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Empty object
*
*/
class EditSettingsController extends Controller {
const PATH = '/edit-settings';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/enable-registration Enable the registration.
*
* @apiName Enable registration
*
* @apiGroup system
*
* @apiDescription This path enable the registration.
*
* @apiPermission Staff level 3
*
* @apiParam {String} password The password of the current staff.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PASSWORD
*
* @apiSuccess {Object} data Empty object
*
*/
class EnableRegistrationController extends Controller {
const PATH = '/enable-registration';
const METHOD = 'POST';

View File

@ -1,5 +1,26 @@
<?php
/**
* @api {post} /system/enable-user-system Enable user system.
*
* @apiName Enable user system
*
* @apiGroup system
*
* @apiDescription This path enable the user system.
*
* @apiPermission Staff level 3
*
* @apiParam {String} password The password of the current staff.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PASSWORD
* @apiUse SYSTEM_USER_IS_ALREADY_ENABLED
*
* @apiSuccess {Object} data Empty object
*
*/
class EnableUserSystemController extends Controller {
const PATH = '/enable-user-system';
const METHOD = 'POST';

View File

@ -1,6 +1,23 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/get-api-keys Retrieve api keys.
*
* @apiName Get api keys
*
* @apiGroup system
*
* @apiDescription This path retrieves the all api keys.
*
* @apiPermission Staff level 3
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[APIKey](#api-Data_Structures-ObjectApikey)[]} data Array of api keys
*
*/
class GetAPIKeysController extends Controller {
const PATH = '/get-api-keys';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/get-logs retrieve logs.
*
* @apiName Get logs
*
* @apiGroup system
*
* @apiDescription This path retrieves the all logs.
*
* @apiPermission Staff level 1
*
* @apiParam {Number} page The page of logs.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PAGE
*
* @apiSuccess {[Log](#api-Data_Structures-ObjectLog)[]} data Array of last logs
*
*/
class GetLogsController extends Controller {
const PATH = '/get-logs';
const METHOD = 'POST';

View File

@ -1,6 +1,23 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/get-mail-templates Retrieve mail templates.
*
* @apiName Get mail templates
*
* @apiGroup system
*
* @apiDescription This path retrieves the all mail templates.
*
* @apiPermission Staff level 3
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[MailTemplate](#api-Data_Structures-ObjectMailtemplate)[]} data Array of mail templates
*
*/
class GetMailTemplatesController extends Controller {
const PATH = '/get-mail-templates';
const METHOD = 'POST';

View File

@ -1,5 +1,22 @@
<?php
/**
* @api {post} /system/get-settings Retrieve settings.
*
* @apiName Get settings
*
* @apiGroup system
*
* @apiDescription This path retrieves one or more settings.
*
* @apiPermission any
*
* @apiParam {Boolean} allSettings A bool that means if you want a regular settings list or a complety settings list.
*
* @apiSuccess {Object} data Contains the information about the settings
*
*/
class GetSettingsController extends Controller {
const PATH = '/get-settings';
const METHOD = 'POST';

View File

@ -1,6 +1,27 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/get-stats Retrieve stats.
*
* @apiName Get stats
*
* @apiGroup system
*
* @apiDescription This path retrieves stats.
*
* @apiPermission Staff level 1
*
* @apiParam {String} period Period of search.
* @apiParam {Number} staffId Id of the current staff.
* @apiUse NO_PERMISSION
* @apiUse INVALID_PERIOD
*
* @apiSuccess {[StatList](#api-Data_Structures-ObjectStatlist)[]} data Array of the stats
*
*/
class GetStatsController extends Controller {
const PATH = '/get-stats';
const METHOD = 'POST';

View File

@ -2,6 +2,30 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /system/init-admin Create the main administrator account.
*
* @apiName Init admin
*
* @apiGroup system
*
* @apiDescription This path create the main administrator account.
*
* @apiPermission any
*
* @apiParam {String} name Name of the administrator.
* @apiParam {String} email Email of the administrator.
* @apiParam {String} password Password of the administrator.
*
* @apiUse INVALID_NAME
* @apiUse INVALID_EMAIL
* @apiUse INVALID_PASSWORD
* @apiUse INIT_SETTINGS_DONE
*
* @apiSuccess {Object} data Empty object
*
*/
class InitAdminController extends Controller {
const PATH = '/init-admin';
const METHOD = 'POST';

View File

@ -1,6 +1,28 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /system/recover-mail-template Recover mail template.
*
* @apiName Recover mail template
*
* @apiGroup system
*
* @apiDescription This path recover olds mail templates.
*
* @apiPermission Staff level 3
*
* @apiParam {String} templateType type of the template.
* @apiParam {String} language language of the template.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TEMPLATE
* @apiUse INVALID_LANGUAGE
*
* @apiSuccess {Object} data Empty object
*
*/
class RecoverMailTemplateController extends Controller {
const PATH = '/recover-mail-template';
const METHOD = 'POST';

View File

@ -2,6 +2,30 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/add-custom-response Add new custom responses.
*
* @apiName Add a custom response
*
* @apiGroup Ticket
*
* @apiDescription This path allows create new custom responses for tickets.
*
* @apiPermission Staff Level 2
*
* @apiParam {String} name Name of the response.
* @apiParam {String} content Content of the response.
* @apiParam {String} language Language of the response.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
* @apiUse INVALID_CONTENT
* @apiUse INVALID_LANGUAGE
*
* @apiSuccess {Object} data Empty object
*
*/
class AddCustomResponseController extends Controller {
const PATH = '/add-custom-response';
const METHOD = 'POST';

View File

@ -2,6 +2,28 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/change-department Change the department of a ticket.
*
* @apiName Change department
*
* @apiGroup Ticket
*
* @apiDescription This path change the department of a ticket.
*
* @apiPermission Staff Level 1
*
* @apiParam {Number} ticketNumber The number of a ticket.
* @apiParam {Number} departmentId The id of the new department of the ticket.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
* @apiUse INVALID_DEPARTMENT
*
* @apiSuccess {Object} data Empty object
*
*/
class ChangeDepartmentController extends Controller {
const PATH = '/change-department';
const METHOD = 'POST';

View File

@ -1,6 +1,28 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /ticket/change-priority Change the priority of a ticket.
*
* @apiName Change priority
*
* @apiGroup Ticket
*
* @apiDescription This path change the priority of a ticket.
*
* @apiPermission Staff Level 1
*
* @apiParam {Number} ticketNumber The number of a ticket.
* @apiParam {String} priority The new priority of the ticket.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
* @apiUse INVALID_PRIORITY
*
* @apiSuccess {Object} data Empty object
*
*/
class ChangePriorityController extends Controller {
const PATH = '/change-priority';
const METHOD = 'POST';

View File

@ -2,6 +2,32 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/check Check if a ticket was or not readed.
*
* @apiName Check
*
* @apiGroup Ticket
*
* @apiDescription This path check if a ticket was or not readed.
*
* @apiPermission any
*
* @apiParam {Number} ticketNumber The number of a ticket.
* @apiParam {String} email Email of the person who created the ticket.
* @apiParam {String} captcha Encrypted value generated by google captcha client.
*
* @apiUse INVALID_TICKET
* @apiUse INVALID_EMAIL
* @apiUse INVALID_CAPTCHA
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Data for the ticket session
* @apiSuccess {String} data.token Token of the ticket session
* @apiSuccess {Number} data.ticketNumber Number of the ticket
*
*/
class CheckTicketController extends Controller {
const PATH = '/check';
const METHOD = 'POST';

View File

@ -2,6 +2,26 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/close Close a ticket.
*
* @apiName Close
*
* @apiGroup Ticket
*
* @apiDescription This path close a ticket.
*
* @apiPermission user
*
* @apiParam {Number} ticketNumber The number of a ticket.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
*
* @apiSuccess {Object} data Empty object
*
*/
class CloseController extends Controller {
const PATH = '/close';
const METHOD = 'POST';

View File

@ -2,6 +2,29 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/comment Comment a ticket.
*
* @apiName Comment
*
* @apiGroup Ticket
*
* @apiDescription This path comment a ticket.
*
* @apiPermission user
*
* @apiParam {String} content Content of the comment.
* @apiParam {Number} ticketNumber The number of the ticket to comment.
* @apiParam {String} csrf_token Token of the session.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_CONTENT
* @apiUse INVALID_TICKET
*
* @apiSuccess {Object} data Empty object
*
*/
class CommentController extends Controller {
const PATH = '/comment';
const METHOD = 'POST';

View File

@ -2,6 +2,36 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/create Create a new ticket.
*
* @apiName Create
*
* @apiGroup Ticket
*
* @apiDescription This path create a new ticket.
*
* @apiPermission user
*
* @apiParam {String} title Title of the ticket.
* @apiParam {String} content Content of the ticket.
* @apiParam {Number} departmentId The id of the department of the current ticket.
* @apiParam {String} language The language of the ticket.
* @apiParam {String} email The email of the user who created the ticket.
* @apiParam {String} name The Name of the author of the ticket.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TITLE
* @apiUse INVALID_CONTENT
* @apiUse INVALID_DEPARTMENT
* @apiUse INVALID_LANGUAGE
* @apiUse INVALID_CAPTCHA
*
* @apiSuccess {Object} data Information of the new ticket
* @apiSuccess {Number} data.ticketNumber Number of the new ticket
*
*/
class CreateController extends Controller {
const PATH = '/create';
const METHOD = 'POST';

View File

@ -2,6 +2,26 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @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
*
* @apiParam {Number} id Id of the custom response to delete.
*
* @apiUse NO_PERMISSION
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Empty object
*
*/
class DeleteCustomResponseController extends Controller {
const PATH = '/delete-custom-response';
const METHOD = 'POST';

View File

@ -2,6 +2,29 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/edit-custom-response Edit a custom response.
*
* @apiName Edit custom response
*
* @apiGroup Ticket
*
* @apiDescription This path edit a custom response.
*
* @apiPermission Staff level 2
*
* @apiParam {Number} id Id of the custom response to edit.
* @apiParam {String} content The new content of the custom response.
* @apiParam {String} language The new language of the custom response.
* @apiParam {String} name The new name of the custom response.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_NAME
*
* @apiSuccess {Object} data Empty object
*
*/
class EditCustomResponseController extends Controller {
const PATH = '/edit-custom-response';
const METHOD = 'POST';

View File

@ -2,6 +2,23 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/get-custom-responses Retrieve customs responses.
*
* @apiName Get custom responses
*
* @apiGroup Ticket
*
* @apiDescription This path give back custom responses.
*
* @apiPermission Staff level 1
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[CustomResponse](#api-Data_Structures-ObjectCustomresponse)[]} data List of custom responses.
*
*/
class GetCustomResponsesController extends Controller {
const PATH = '/get-custom-responses';
const METHOD = 'POST';

View File

@ -1,6 +1,27 @@
<?php
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /ticket/get Retrieve Ticket information.
*
* @apiName GetTicket
*
* @apiGroup Ticket
*
* @apiDescription This path retrieves information about a ticket.
*
* @apiPermission any
*
* @apiParam {Number} ticketNumber The number of the ticket.
* @apiParam {String} csrf_token Token of the current session.
*
* @apiUse INVALID_TICKET
* @apiUse NO_PERMISSION
*
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)} data Information about the requested ticket.
*
*/
class TicketGetController extends Controller {
const PATH = '/get';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /ticket/re-open Re open a closed ticket.
*
* @apiName Re open
*
* @apiGroup Ticket
*
* @apiDescription This path re open a closed ticket.
*
* @apiPermission user
*
* @apiParam {String} ticketNumber Number of the ticket to be reopened.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
*
* @apiSuccess {Object} data Empty object
*
*/
class ReOpenController extends Controller {
const PATH = '/re-open';
const METHOD = 'POST';

View File

@ -1,6 +1,27 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /ticket/seen See if a ticket was or not seen.
*
* @apiName Seen
*
* @apiGroup Ticket
*
* @apiDescription This path see if a ticket was or not seen.
*
* @apiPermission user
*
* @apiParam {String} ticketNumber Number of the ticket.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_TICKET
*
* @apiSuccess {Object} data Empty object
*
*/
class SeenController extends Controller {
const PATH = '/seen';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/ban Bans email users.
*
* @apiName BanUser
*
* @apiGroup User
*
* @apiDescription This path takes an Email and bans it.
*
* @apiPermission Staff Level 1
*
* @apiParam {String} email Email of user to ban.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_EMAIL
* @apiUse ALREADY_BANNED
*
* @apiSuccess {Object} data Empty object
*
*/
class BanUserController extends Controller {
const PATH = '/ban';
const METHOD = 'POST';

View File

@ -1,5 +1,21 @@
<?php
/**
* @api {post} /user/check-session Check if session exist or not.
*
* @apiName Check session
*
* @apiGroup User
*
* @apiDescription This path retrieves a object that says if a session exist or not.
*
* @apiPermission Any
*
* @apiSuccess {Object} data Information about the session
* @apiSuccess {Boolean} data.sessionActive Indicate if the session is activated
*
*/
class CheckSessionController extends Controller {
const PATH = '/check-session';
const METHOD = 'POST';

View File

@ -2,6 +2,27 @@
use Respect\Validation\Validator as DataValidator;
use RedBeanPHP\Facade as RedBean;
/**
* @api {post} /user/delete Delete a user.
*
* @apiName Delete
*
* @apiGroup User
*
* @apiDescription This path receive a user id and delete its user.
*
* @apiPermission Staff level 1
*
* @apiParam {Number} userId The id of the user to delete.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_USER
* @apiUse USER_SYSTEM_DISABLED
*
* @apiSuccess {Object} data Empty object
*
*/
DataValidator::with('CustomValidations', true);
class DeleteUserController extends Controller {

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/edit-email Edit email of an user.
*
* @apiName Edit-email
*
* @apiGroup User
*
* @apiDescription This path change the email of a user.
*
* @apiPermission User
*
* @apiParam {String} newEmail The new email that the user wants to change.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_EMAIL
*
* @apiSuccess {Object} data Empty object
*
*/
class EditEmail extends Controller{
const PATH = '/edit-email';
const METHOD = 'POST';

View File

@ -1,6 +1,28 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/edit-password Edit password of an user.
*
* @apiName Edit-password
*
* @apiGroup User
*
* @apiDescription This path edit the password of a user.
*
* @apiPermission User
*
* @apiParam {String} newPassword The new password that the user wants to change.
* @apiParam {String} oldPassword The actual password of the user.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PASSWORD
* @apiUse INVALID_OLD_PASSWORD
*
* @apiSuccess {Object} data Empty object
*
*/
class EditPassword extends Controller {
const PATH = '/edit-password';
const METHOD = 'POST';

View File

@ -2,6 +2,32 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/get-user Retrieve the information of an specific user.
*
* @apiName Get-user
*
* @apiGroup User
*
* @apiDescription This path retrieves information about an specific user.
*
* @apiPermission Staff level 1
*
* @apiParam {String} userId The id of the user to find information of.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_USER
* @apiUse USER_SYSTEM_DISABLED
*
* @apiSuccess {Object} data Information about a user
* @apiSuccess {String} data.name Name of the user
* @apiSuccess {String} data.email Email of the user
* @apiSuccess {Number} data.signupDate Date of signup of the user
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data.tickets Array of tickets of the user
* @apiSuccess {Boolean} data.verified Indicates if the user is verified
*
*/
class GetUserByIdController extends Controller {
const PATH = '/get-user';
const METHOD = 'POST';

View File

@ -1,6 +1,36 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/get-users Retrieve the information of a list of users.
*
* @apiName Get-users
*
* @apiGroup User
*
* @apiDescription This path retrieves information about a list of users.
*
* @apiPermission Staff level 1
*
* @apiParam {Number} page Number of pages of users.
* @apiParam {String} orderBy Parameter to order the users by tickets or id.
* @apiParam {Boolean} desc Parameter to order the user ascending or descending way.
* @apiParam {String} search Key to find some specific users.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_PAGE
* @apiUse INVALID_ORDER
* @apiUse USER_SYSTEM_DISABLED
*
* @apiSuccess {Object} data
* @apiSuccess {[User](#api-Data_Structures-ObjectUser)[]} data.users Array of users found
* @apiSuccess {Number} data.pages Number of pages found
* @apiSuccess {Number} data.page Number of the page
* @apiSuccess {String} data.orderBy Indicates if it's ordered by id or quantity of tickets
* @apiSuccess {Boolean} data.desc Indicates if it's ordered in decreasing order
* @apiSuccess {String} data.search Query of the search
*/
class GetUsersController extends Controller {
const PATH = '/get-users';
const METHOD = 'POST';

View File

@ -2,6 +2,29 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/get Retrieve the information of yourself.
*
* @apiName Get
*
* @apiGroup User
*
* @apiDescription This path retrieve the information of a user.
*
* @apiPermission User
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_CREDENTIALS
*
* @apiSuccess {Object} data Information about a user
* @apiSuccess {String} data.name Name of the user
* @apiSuccess {String} data.email Email of the user
* @apiSuccess {Boolean} data.verified Indicates if the user is verified
* @apiSuccess {Object} data Information about a user
* @apiSuccess {[Ticket](#api-Data_Structures-ObjectTicket)[]} data.tickets Array of tickets of the user
*
*/
class GetUserController extends Controller {
const PATH = '/get';
const METHOD = 'POST';

View File

@ -1,6 +1,23 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/list-ban Retrieve the list of banned users.
*
* @apiName List-ban
*
* @apiGroup User
*
* @apiDescription This path retrieves the list of banned users.
*
* @apiPermission Staff level 1
*
* @apiUse NO_PERMISSION
*
* @apiSuccess {[Ban](#api-Data_Structures-ObjectBan)[]} data Array of emails banned
*
*/
class ListBanUserController extends Controller {
const PATH = '/list-ban';
const METHOD = 'POST';

View File

@ -1,5 +1,37 @@
<?php
/**
* @api {post} /user/login Login a user.
*
* @apiName Login
*
* @apiGroup User
*
* @apiDescription This path login a user.
*
* @apiPermission Any
*
* @apiParam {Boolean} staff A bool that say if it want to login a staff or a normal user.
* @apiParam {String} email The email of the user to login.
* @apiParam {String} password The password of the user to login.
* @apiParam {Boolean} remember A bool that say if the session wants to be remembered.
* @apiParam {Number} userId The id of the user to login.
* @apiParam {String} rememberToken Token to login automatically.
*
* @apiUse USER_SYSTEM_DISABLED
* @apiUse SESSION_EXISTS
* @apiUse UNVERIFIED_USER
* @apiUse INVALID_CREDENTIALS
*
* @apiSuccess {Object} data Information about the session
* @apiSuccess {Number} data.userId Id of the user
* @apiSuccess {String} data.userEmail Email of the user
* @apiSuccess {Boolean} data.staff Indicates if the user is staff or not
* @apiSuccess {String} data.token Token of the session, used to verify the session when making other requests
* @apiSuccess {String} data.rememberToken Token of the remember session for automatic login
*
*/
class LoginController extends Controller {
const PATH = '/login';
const METHOD = 'POST';

View File

@ -1,4 +1,18 @@
<?php
/**
* @api {post} /user/logout Log out the current user.
*
* @apiName Log out
*
* @apiGroup User
*
* @apiDescription This path log out the current user.
*
* @apiPermission Any
*
* @apiSuccess {Object} data Empty object
*
*/
class LogoutController extends Controller {
const PATH = '/logout';
const METHOD = 'POST';

View File

@ -2,6 +2,30 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/recover-password Change the password of the user using a token sended from the email.
*
* @apiName Recover password
*
* @apiGroup User
*
* @apiDescription This path change the password of the user usign a token sended from the email.
*
* @apiPermission Any
*
* @apiParam {String} email The email of the user who forgot the password.
* @apiParam {String} password The new password of the user.
* @apiParam {String} token The token that was sended to the email of the user.
*
* @apiUse INVALID_EMAIL
* @apiUse INVALID_PASSWORD
* @apiUse USER_SYSTEM_DISABLED
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Empty object
*
*/
class RecoverPasswordController extends Controller {
const PATH = '/recover-password';
const METHOD = 'POST';

View File

@ -2,6 +2,27 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/send-recover-password Send a token to the email of the user to change his password
*
* @apiName Send recover password
*
* @apiGroup User
*
* @apiDescription This path send a token to the email of the user to change his password.
*
* @apiPermission Any
*
* @apiParam {String} email The email of the user who forgot the password.
*
* @apiUse INVALID_EMAIL
* @apiUse USER_SYSTEM_DISABLED
* @apiUse INVALID_EMAIL
*
* @apiSuccess {Object} data Empty object.
*
*/
class SendRecoverPasswordController extends Controller {
const PATH = '/send-recover-password';
const METHOD = 'POST';

View File

@ -3,6 +3,37 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/signup Sign up a new user.
*
* @apiName Sign up
*
* @apiGroup User
*
* @apiDescription This path sign up a user on the system.
*
* @apiPermission Any
*
* @apiParam {String} name The name of the new user.
* @apiParam {String} email The email of the new user.
* @apiParam {String} password The password of the new user.
* @apiParam {String} apyKey Key to sign up a user if the user system is disabled.
*
* @apiUse INVALID_NAME
* @apiUse INVALID_EMAIL
* @apiUse INVALID_PASSWORD
* @apiUse INVALID_CAPTCHA
* @apiUse USER_SYSTEM_DISABLED
* @apiUse USER_EXISTS
* @apiUse ALREADY_BANNED
* @apiUse NO_PERMISSION
*
* @apiSuccess {Object} data Information about created user
* @apiSuccess {Number} data.userId Id of the new user
* @apiSuccess {String} data.userEmail Email of the new user
*
*/
class SignUpController extends Controller {
const PATH = '/signup';
const METHOD = 'POST';

View File

@ -1,6 +1,26 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/un-ban Take a user out of banned list.
*
* @apiName Un ban
*
* @apiGroup User
*
* @apiDescription This path take a user out of banned list.
*
* @apiPermission Staff level 1
*
* @apiParam {String} email The email of the user who was banned.
*
* @apiUse NO_PERMISSION
* @apiUse INVALID_EMAIL
*
* @apiSuccess {Object} data Empty object
*
*/
class UnBanUserController extends Controller {
const PATH = '/un-ban';
const METHOD = 'POST';

View File

@ -1,6 +1,28 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/verify Verify the email of a new user.
*
* @apiName Verify
*
* @apiGroup User
*
* @apiDescription This path verify the email of a new user.
*
* @apiPermission any
*
* @apiParam {String} email The email of the user.
* @apiParam {String} token The key of validation the user.
*
* @apiUse INVALID_EMAIL
* @apiUse USER_SYSTEM_DISABLED
* @apiUse INVALID_TOKEN
*
* @apiSuccess {Object} data Empty object
*
*/
class VerifyController extends Controller{
const PATH = '/verify';
const METHOD = 'POST';

View File

@ -1,4 +1,177 @@
<?php
/**
* @apiDefine INVALID_CREDENTIALS
* @apiError {String} INVALID_CREDENTIALS Login credentials does not match.
*/
/**
* @apiDefine SESSION_EXISTS
* @apiError {String} SESSION_EXISTS The session already exists.
*/
/**
* @apiDefine USER_EXISTS
* @apiError {String} USER_EXISTS The user already exists.
*/
/**
* @apiDefine NO_PERMISSION
* @apiError {String} NO_PERMISSION You have no permission to perform this operation.
*/
/**
* @apiDefine INVALID_TITLE
* @apiError {String} INVALID_TITLE The title is invalid, probably too short.
*/
/**
* @apiDefine INVALID_CONTENT
* @apiError {String} INVALID_CONTENT The content is invalid, probably to short.
*/
/**
* @apiDefine INVALID_EMAIL
* @apiError {String} INVALID_EMAIL The email is invalid or already exists.
*/
/**
* @apiDefine INVALID_PASSWORD
* @apiError {String} INVALID_PASSWORD The password is invalid, probably too short.
*/
/**
* @apiDefine INVALID_NAME
* @apiError {String} INVALID_NAME The name is invalid, probably too short.
*/
/**
* @apiDefine INVALID_SETTING
* @apiError {String} INVALID_SETTING The setting are invalid.
*/
/**
* @apiDefine INVALID_DEPARTMENT
* @apiError {String} INVALID_DEPARTMENT The dapartment is invalid, probably too short.
*/
/**
* @apiDefine INVALID_TICKET
* @apiError {String} INVALID_TICKET The ticket is invalid.
*/
/**
* @apiDefine INIT_SETTINGS_DONE
* @apiError {String} INIT_SETTINGS_DONE The init settings are already done.
*/
/**
* @apiDefine INVALID_OLD_PASSWORD
* @apiError {String} INVALID_OLD_PASSWORD The old password is invalid.
*/
/**
* @apiDefine INVALID_CAPTCHA
* @apiError {String} INVALID_CAPTCHA The captcha is invalid.
*/
/**
* @apiDefine INVALID_TICKET_EVENT
* @apiError {String} INVALID_TICKET_EVENT The ticket event is invalid.
*/
/**
* @apiDefine INVALID_LANGUAGE
* @apiError {String} INVALID_LANGUAGE The language is invalid.
*/
/**
* @apiDefine TICKET_ALREADY_ASSIGNED
* @apiError {String} TICKET_ALREADY_ASSIGNED The ticket is already assigned.
*/
/**
* @apiDefine INVALID_PRIORITY
* @apiError {String} INVALID_PRIORITY The priority is invalid.
*/
/**
* @apiDefine INVALID_PAGE
* @apiError {String} INVALID_PAGE The page is invalid.
*/
/**
* @apiDefine INVALID_QUERY
* @apiError {String} INVALID_QUERY The query is invalid.
*/
/**
* @apiDefine INVALID_TOPIC
* @apiError {String} INVALID_TOPIC The topic is invalid.
*/
/**
* @apiDefine INVALID_SEARCH
* @apiError {String} INVALID_SEARCH The search is invalid.
*/
/**
* @apiDefine INVALID_ORDER
* @apiError {String} INVALID_ORDER The order is invalid.
*/
/**
* @apiDefine INVALID_USER
* @apiError {String} INVALID_USER The user is invalid.
*/
/**
* @apiDefine ALREADY_BANNED
* @apiError {String} ALREADY_BANNED It's already banned.
*/
/**
* @apiDefine INVALID_LEVEL
* @apiError {String} INVALID_LEVEL The level is invalid.
*/
/**
* @apiDefine ALREADY_A_STAFF
* @apiError {String} ALREADY_A_STAFF It's already a staff.
*/
/**
* @apiDefine INVALID_STAFF
* @apiError {String} INVALID_STAFF The staff is invalid.
*/
/**
* @apiDefine SAME_DEPARTMENT
* @apiError {String} SAME_DEPARTMENT It's the same department.
*/
/**
* @apiDefine INVALID_TOKEN
* @apiError {String} INVALID_TOKEN The token is invalid.
*/
/**
* @apiDefine UNVERIFIED_USER
* @apiError {String} UNVERIFIED_USER The user is not verified.
*/
/**
* @apiDefine INVALID_TEMPLATE
* @apiError {String} INVALID_TEMPLATE The template is invalid.
*/
/**
* @apiDefine INVALID_SUBJECT
* @apiError {String} INVALID_SUBJECT The subject is invalid.
*/
/**
* @apiDefine INVALID_BODY
* @apiError {String} INVALID_BODY The body is invalid.
*/
/**
* @apiDefine USER_SYSTEM_DISABLED
* @apiError {String} USER_SYSTEM_DISABLED The user system is disabled.
*/
/**
* @apiDefine SYSTEM_USER_IS_ALREADY_DISABLED
* @apiError {String} SYSTEM_USER_IS_ALREADY_DISABLED The system user is already disabled.
*/
/**
* @apiDefine SYSTEM_USER_IS_ALREADY_ENABLED
* @apiError {String} SYSTEM_USER_IS_ALREADY_ENABLED The system user is already enabled.
*/
/**
* @apiDefine INVALID_PERIOD
* @apiError {String} INVALID_PERIOD The period is invalid.
*/
/**
* @apiDefine NAME_ALREADY_USED
* @apiError {String} NAME_ALREADY_USED The name is already used.
*/
/**
* @apiDefine INVALID_FILE
* @apiError {String} INVALID_FILE The file is invalid.
*/
/**
* @apiDefine DATABASE_CONNECTION
* @apiError {String} DATABASE_CONNECTION It's a database connection error.
*/
/**
* @apiDefine DATABASE_CREATION
* @apiError {String} DATABASE_CREATION It's a database creation error.
*/
class ERRORS {
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
const SESSION_EXISTS = 'SESSION_EXISTS';

View File

@ -1,4 +1,10 @@
<?php
/**
* @api {OBJECT} APIKey APIKey
* @apiGroup Data Structures
* @apiParam {String} name Name of the APIKey.
* @apiParam {String} token Token of the APIKey.
*/
class APIKey extends DataStore {
const TABLE = 'apikey';

View File

@ -1,4 +1,13 @@
<?php
/**
* @api {OBJECT} Article Article
* @apiGroup Data Structures
* @apiParam {Number} id Id of the article.
* @apiParam {String} title Title of the article.
* @apiParam {String} content Content of the article.
* @apiParam {Number} lastEdited Last edit of the article.
* @apiParam {Number} position Position of the article.
*/
class Article extends DataStore {
const TABLE = 'article';

View File

@ -1,4 +1,10 @@
<?php
/**
* @api {OBJECT} Article Article
* @apiGroup Data Structures
* @apiParam {Email} email Email of the user banned.
*/
class Ban extends DataStore {
const TABLE = 'ban';

View File

@ -1,4 +1,12 @@
<?php
/**
* @api {OBJECT} CustomResponse CustomResponse
* @apiGroup Data Structures
* @apiParam {Number} id Id of the custom response.
* @apiParam {String} content Content of the custom response.
* @apiParam {String} name Name of the custom response.
* @apiParam {String} language Language of the custom response.
*/
class CustomResponse extends DataStore {
const TABLE = 'customresponse';

View File

@ -1,6 +1,14 @@
<?php
use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} Department Department
* @apiGroup Data Structures
* @apiParam {Number} id Id of the custom response.
* @apiParam {String} name Name of the custom response.
* @apiParam {[Staff](#api-Data_Structures-ObjectStaff)[]} owners Owners of the department.
*/
class Department extends DataStore {
const TABLE = 'department';

View File

@ -1,5 +1,16 @@
<?php
use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} Log Log
* @apiGroup Data Structures
* @apiParam {String} type The type of the log.
* @apiParam {String} to Destinatary of the log.
* @apiParam {Object} author Author of the log.
* @apiParam {String} author.name Name of the author.
* @apiParam {Number} author.id Id of the author.
* @apiParam {Boolean} author.staff Kind of author.
* @apiParam {String} date Date of creation of the log.
*/
class Log extends DataStore {
const TABLE = 'log';

View File

@ -1,6 +1,15 @@
<?php
use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} MailTemplate MailTemplate
* @apiGroup Data Structures
* @apiParam {String} type The type of the mail template.
* @apiParam {String} subject The subject of the mail template.
* @apiParam {string} language The language of the mail template.
* @apiParam {String} body The body of the mail template.
*/
class MailTemplate extends DataStore {
const TABLE = 'mailtemplate';

View File

@ -1,4 +1,16 @@
<?php
/**
* @api {OBJECT} Staff Staff
* @apiGroup Data Structures
* @apiParam {Number} id The type of the mail template.
* @apiParam {String} name The subject of the mail template.
* @apiParam {String} email The language of the mail template.
* @apiParam {String} profilePic The body of the mail template.
* @apiParam {Number} level The language of the mail template.
* @apiParam {Object[]} departments The departments of the staff.
* @apiParam {[Ticket](#api-Data_Structures-ObjectTicket)[]} tickets The tickets of the staff.
* @apiParam {Number} lastLogin The last login of the staff.
*/
class Staff extends DataStore {
const TABLE = 'staff';

View File

@ -1,4 +1,13 @@
<?php
/**
* @api {OBJECT} Stat Stat
* @apiGroup Data Structures
* @apiParam {Number} date The date of the stat.
* @apiParam {String} type The type of the stat.
* @apiParam {Boolean} general The general of the stat.
* @apiParam {String} value The value of the stat.
*/
class Stat extends DataStore {
const TABLE = 'stat';

View File

@ -1,4 +1,29 @@
<?php
/**
* @api {OBJECT} Ticket Ticket
* @apiGroup Data Structures
* @apiParam {Number} ticketNumber The number of the ticket.
* @apiParam {String} title The title of the ticket.
* @apiParam {String} content The content of the ticket.
* @apiParam {Object} department The department of the ticket.
* @apiParam {Number} department.id The id of the department of the ticket.
* @apiParam {String} department.name The department's name of the ticket.
* @apiParam {String} file The file of the ticket.
* @apiParam {String} language The language of the ticket.
* @apiParam {Boolean} unread The boolean to know if the user already readed or not.
* @apiParam {Boolean} unreadStaff The boolean to know if the staff already readed or not.
* @apiParam {Boolean} closed The boolean to know if the ticket is already closed or not.
* @apiParam {String} priority The priority of the ticket.
* @apiParam {Object} author The author of the ticket.
* @apiParam {Number} author.id The id of the author of the ticket.
* @apiParam {String} author.name The author's name of the ticket.
* @apiParam {String} author.email The author's email of the ticket.
* @apiParam {Object} owner The owner of the ticket.
* @apiParam {Number} owner.id The owner's id of the ticket.
* @apiParam {String} owner.name The owner's name of the ticket.
* @apiParam {String} owner.email The owner's email of the ticket.
* @apiParam {[TicketEvent](#api-Data_Structures-ObjectTicketevent)[]} events Events related to the ticket.
*/
use RedBeanPHP\Facade as RedBean;
class Ticket extends DataStore {

View File

@ -1,4 +1,18 @@
<?php
/**
* @api {OBJECT} TicketEvent TicketEvent
* @apiGroup Data Structures
* @apiParam {String} type The type of the ticket event.
* @apiParam {String} content The content of the ticket event.
* @apiParam {Object} author The author of the ticket event.
* @apiParam {Number} author.id The author's id of the ticket event.
* @apiParam {String} author.name The author's name of the ticket event.
* @apiParam {String} author.email The author's email of the ticket event.
* @apiParam {String} author.profilePic The author's profilePic of the ticket event.
* @apiParam {Boolean} author.staff The boolean to know if the author is staff or not.
* @apiParam {String} date The date of the ticket event.
* @apiParam {String} file The file of the ticket event.
*/
class Ticketevent extends DataStore {
const TABLE = 'ticketevent';

View File

@ -1,4 +1,13 @@
<?php
/**
* @api {OBJECT} Topic Topic
* @apiGroup Data Structures
* @apiParam {Number} id Id of the topic.
* @apiParam {String} name Name of the topic.
* @apiParam {String} icon Icon of the topic.
* @apiParam {String} iconColor Icon's color of the topic.
* @apiParam {[Article](#api-Data_Structures-ObjectArticle)[]} articles Articles of the Topic.
*/
class Topic extends DataStore {
const TABLE = 'topic';

View File

@ -1,6 +1,15 @@
<?php
use RedBeanPHP\Facade as RedBean;
/**
* @api {OBJECT} User User
* @apiGroup Data Structures
* @apiParam {String} email The email of the user.
* @apiParam {Number} id The id of the user.
* @apiParam {String} name The name of the user.
* @apiParam {Boolean} verified A boolean to know if the user is already verified or not.
*/
class User extends DataStore {
const TABLE = 'user';