From 8bc74384c2a676fcc2db5e3c94c827a3fb2cf94f Mon Sep 17 00:00:00 2001 From: AntonyAntonio Date: Mon, 17 Apr 2017 21:40:44 -0300 Subject: [PATCH] Guillermo - data articles [skip ci] --- server/controllers/article/add-topic.php | 23 ++++++++++++++++++ server/controllers/article/add.php | 25 +++++++++++++++++++ server/controllers/article/delete-topic.php | 19 +++++++++++++++ server/controllers/article/delete.php | 19 +++++++++++++++ server/controllers/article/edit-topic.php | 25 +++++++++++++++++++ server/controllers/article/edit.php | 27 +++++++++++++++++++++ server/controllers/article/get-all.php | 15 ++++++++++++ 7 files changed, 153 insertions(+) diff --git a/server/controllers/article/add-topic.php b/server/controllers/article/add-topic.php index d58e6458..796a81b0 100644 --- a/server/controllers/article/add-topic.php +++ b/server/controllers/article/add-topic.php @@ -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. + * + * @apiError {String} message + * + * @apiSuccess {Object} data + * + */ + class AddTopicController extends Controller { const PATH = '/add-topic'; const METHOD = 'POST'; diff --git a/server/controllers/article/add.php b/server/controllers/article/add.php index 71fc92c5..296e81c9 100644 --- a/server/controllers/article/add.php +++ b/server/controllers/article/add.php @@ -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. + * + * @apiError {String} message + * + * @apiSuccess {Object} data + * + */ + class AddArticleController extends Controller { const PATH = '/add'; const METHOD = 'POST'; diff --git a/server/controllers/article/delete-topic.php b/server/controllers/article/delete-topic.php index ba10905a..a754980f 100644 --- a/server/controllers/article/delete-topic.php +++ b/server/controllers/article/delete-topic.php @@ -2,6 +2,25 @@ 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. + * + * @apiError {String} message + * + * @apiSuccess {Object} data + * + */ + class DeleteTopicController extends Controller { const PATH = '/delete-topic'; const METHOD = 'POST'; diff --git a/server/controllers/article/delete.php b/server/controllers/article/delete.php index 44886e16..bc418c31 100644 --- a/server/controllers/article/delete.php +++ b/server/controllers/article/delete.php @@ -2,6 +2,25 @@ 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. + * + * @apiError {String} message + * + * @apiSuccess {Object} data + * + */ + class DeleteArticleController extends Controller { const PATH = '/delete'; const METHOD = 'POST'; diff --git a/server/controllers/article/edit-topic.php b/server/controllers/article/edit-topic.php index 5717557b..3e4f4b8b 100644 --- a/server/controllers/article/edit-topic.php +++ b/server/controllers/article/edit-topic.php @@ -2,6 +2,31 @@ 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. + * + * @apiError {String} message + * + * @apiSuccess {Object} data + * + */ + class EditTopicController extends Controller { const PATH = '/edit-topic'; const METHOD = 'POST'; diff --git a/server/controllers/article/edit.php b/server/controllers/article/edit.php index 37bfe492..7386916c 100644 --- a/server/controllers/article/edit.php +++ b/server/controllers/article/edit.php @@ -2,6 +2,33 @@ 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. + * + * @apiError {String} message + * + * @apiSuccess {Object} data + * + */ + class EditArticleController extends Controller { const PATH = '/edit'; const METHOD = 'POST'; diff --git a/server/controllers/article/get-all.php b/server/controllers/article/get-all.php index 3f2577be..2b3781a2 100644 --- a/server/controllers/article/get-all.php +++ b/server/controllers/article/get-all.php @@ -2,6 +2,21 @@ use Respect\Validation\Validator as DataValidator; DataValidator::with('CustomValidations', true); +/** + * @api {post} /article/get-all Get all articles. + * + * @apiName Get all + * + * @apiGroup article + * + * @apiDescription This path give back all the articles. + * + * @apiPermission any + * + * @apiSuccess {Object} data + * + */ + class GetAllArticlesController extends Controller { const PATH = '/get-all'; const METHOD = 'POST';