Guillermo - data user [skip ci]

This commit is contained in:
AntonyAntonio 2017-04-16 02:35:04 -03:00
parent 826d2f1eed
commit 81e9c632b3
16 changed files with 320 additions and 0 deletions

View File

@ -1,6 +1,24 @@
<?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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class BanUserController extends Controller {
const PATH = '/ban';
const METHOD = 'POST';

View File

@ -1,5 +1,22 @@
<?php
/**
* @api {post} /user/check-session check if session exist or not
*
* @apiName check-session
*
* @apiGroup User
*
* @apiDescription This path give back a object that says if a session exist or not.
*
* @apiPermission Any
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class CheckSessionController extends Controller {
const PATH = '/check-session';
const METHOD = 'POST';

View File

@ -2,6 +2,25 @@
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
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
DataValidator::with('CustomValidations', true);
class DeleteUserController extends Controller {

View File

@ -1,6 +1,25 @@
<?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
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class EditEmail extends Controller{
const PATH = '/edit-email';
const METHOD = 'POST';

View File

@ -1,6 +1,27 @@
<?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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class EditPassword extends Controller {
const PATH = '/edit-password';
const METHOD = 'POST';

View File

@ -2,6 +2,25 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/get-user Give back the information of an specific user.
*
* @apiName get-user
*
* @apiGroup User
*
* @apiDescription This path give back information about an specific user.
*
* @apiPermission Staff level 1
*
* @apiParam {string} userId The id of the user to find information of.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class GetUserByIdController extends Controller {
const PATH = '/get-user';
const METHOD = 'POST';

View File

@ -1,6 +1,31 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/get-users Give back the information of a list of users.
*
* @apiName get-users
*
* @apiGroup User
*
* @apiDescription This path give back 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 {bool} desc Parameter to order the user ascending or descending way.
*
* @apiParam {string} search Key to find some specific users.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class GetUsersController extends Controller {
const PATH = '/get-users';
const METHOD = 'POST';

View File

@ -2,6 +2,23 @@
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
/**
* @api {post} /user/get Give back the information of yourself.
*
* @apiName get
*
* @apiGroup User
*
* @apiDescription This path give back the information of a user.
*
* @apiPermission User
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class GetUserController extends Controller {
const PATH = '/get';
const METHOD = 'POST';

View File

@ -1,6 +1,21 @@
<?php
use Respect\Validation\Validator as DataValidator;
/**
* @api {post} /user/list-ban Give back the list of banned users.
*
* @apiName list-ban
*
* @apiGroup User
*
* @apiDescription This path give back the list of banned users.
*
* @apiPermission Staff level 1
*
* @apiSuccess {Object} data
*
*/
class ListBanUserController extends Controller {
const PATH = '/list-ban';
const METHOD = 'POST';

View File

@ -1,5 +1,34 @@
<?php
/**
* @api {post} /user/login Login a user.
*
* @apiName login
*
* @apiGroup User
*
* @apiDescription This path login a user.
*
* @apiPermission Any
*
* @apiParam {bool} 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 {bool} 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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
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
*
*/
class LogoutController extends Controller {
const PATH = '/logout';
const METHOD = 'POST';

View File

@ -2,6 +2,29 @@
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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class RecoverPasswordController extends Controller {
const PATH = '/recover-password';
const METHOD = 'POST';

View File

@ -2,6 +2,25 @@
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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class SendRecoverPasswordController extends Controller {
const PATH = '/send-recover-password';
const METHOD = 'POST';

View File

@ -3,6 +3,31 @@
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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class SignUpController extends Controller {
const PATH = '/signup';
const METHOD = 'POST';

View File

@ -1,6 +1,25 @@
<?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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class UnBanUserController extends Controller {
const PATH = '/un-ban';
const METHOD = 'POST';

View File

@ -1,6 +1,27 @@
<?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.
*
* @apiError {String} message
*
* @apiSuccess {Object} data
*
*/
class VerifyController extends Controller{
const PATH = '/verify';
const METHOD = 'POST';