diff --git a/server/controllers/article/add.php b/server/controllers/article/add.php index cfd980a8..c0433c6e 100755 --- a/server/controllers/article/add.php +++ b/server/controllers/article/add.php @@ -14,7 +14,7 @@ DataValidator::with('CustomValidations', true); * * @apiPermission staff2 * - * @apiParam {String} name Name of the new article. + * @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. @@ -22,10 +22,9 @@ DataValidator::with('CustomValidations', true); * @apiParam image_i The image file of index `i` (mutiple params accepted) * * @apiUse NO_PERMISSION - * @apiUse INVALID_NAME + * @apiUse INVALID_TITLE * @apiUse INVALID_CONTENT * @apiUse INVALID_TOPIC - * @apiUse INVALID_FILE * * @apiSuccess {Object} data Article info * @apiSuccess {Number} data.articleId Article id @@ -39,9 +38,9 @@ class AddArticleController extends Controller { return [ 'permission' => 'staff_2', 'requestData' => [ - 'name' => [ - 'validation' => DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_NAME, LengthConfig::MAX_LENGTH_NAME), - 'error' => ERRORS::INVALID_NAME + 'title' => [ + 'validation' => DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_TITLE, LengthConfig::MAX_LENGTH_TITLE), + 'error' => ERRORS::INVALID_TITLE ], 'content' => [ 'validation' => DataValidator::content(), @@ -64,7 +63,7 @@ class AddArticleController extends Controller { $article = new Article(); $article->setProperties([ - 'title' => Controller::request('name', true), + 'title' => Controller::request('title', true), 'content' => $this->replaceWithImagePaths($imagePaths, $content), 'lastEdited' => Date::getCurrentDate(), 'position' => Controller::request('position') || 1 diff --git a/server/controllers/article/edit-topic.php b/server/controllers/article/edit-topic.php index bae3b865..9090ecc9 100755 --- a/server/controllers/article/edit-topic.php +++ b/server/controllers/article/edit-topic.php @@ -22,6 +22,7 @@ DataValidator::with('CustomValidations', true); * * @apiUse NO_PERMISSION * @apiUse INVALID_TOPIC + * @apiUse INVALID_NAME * * @apiSuccess {Object} data Empty object * @@ -42,8 +43,7 @@ class EditTopicController extends Controller { 'name' => [ 'validation' => DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_NAME, LengthConfig::MAX_LENGTH_NAME), 'error' => ERRORS::INVALID_NAME - ], - + ] ] ]; } diff --git a/server/controllers/article/edit.php b/server/controllers/article/edit.php index 11be69ec..cc46458a 100755 --- a/server/controllers/article/edit.php +++ b/server/controllers/article/edit.php @@ -17,7 +17,7 @@ DataValidator::with('CustomValidations', true); * @apiParam {Number} articleId Id 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} name The new name of the article. Optional. + * @apiParam {String} title The new title of the article. Optional. * @apiParam {Number} position The new position of the article. Optional. * @apiParam {Number} images The number of images in the content * @apiParam image_i The image file of index `i` (mutiple params accepted) @@ -25,6 +25,7 @@ DataValidator::with('CustomValidations', true); * @apiUse NO_PERMISSION * @apiUse INVALID_TOPIC * @apiUse INVALID_FILE + * @apiUse INVALID_TITLE * * @apiSuccess {Object} data Empty object * @@ -42,17 +43,17 @@ class EditArticleController extends Controller { 'validation' => DataValidator::dataStoreId('article'), 'error' => ERRORS::INVALID_TOPIC ], - 'name' => [ + 'title' => [ 'validation' => DataValidator::oneOf( - DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_NAME, LengthConfig::MAX_LENGTH_NAME), + DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_TITLE, LengthConfig::MAX_LENGTH_TITLE), DataValidator::nullType() ), - 'error' => ERRORS::INVALID_NAME + 'error' => ERRORS::INVALID_TITLE ], 'content' => [ 'validation' => DataValidator::oneOf(DataValidator::content(),DataValidator::nullType()), 'error' => ERRORS::INVALID_CONTENT - ], + ] ] ]; } @@ -81,8 +82,8 @@ class EditArticleController extends Controller { $article->content = $this->replaceWithImagePaths($imagePaths, $content); } - if(Controller::request('name')) { - $article->title = Controller::request('name'); + if(Controller::request('title')) { + $article->title = Controller::request('title'); } if(Controller::request('position')) { diff --git a/server/controllers/staff/edit.php b/server/controllers/staff/edit.php index 47d88f80..17baa42e 100755 --- a/server/controllers/staff/edit.php +++ b/server/controllers/staff/edit.php @@ -21,6 +21,9 @@ use Respect\Validation\Validator as DataValidator; * @apiParam {Boolean} sendEmailOnNewTicket Indicates if it receives an email when a new ticket is created. * * @apiUse NO_PERMISSION + * @apiUse INVALID_EMAIL + * @apiUse INVALID_PASSWORD + * @apiUse INVALID_LEVEL * @apiUse INVALID_STAFF * * @apiSuccess {Object} data Empty object @@ -52,7 +55,6 @@ class EditStaffController extends Controller { 'validation' => DataValidator::oneOf(DataValidator::between(1, 3, true), DataValidator::falseVal()), 'error' => ERRORS::INVALID_LEVEL ] - ] ]; }