From 61224d4f0387e2db3c206bf00390b27fe8b51663 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Tue, 23 Jan 2018 18:39:02 +0100
Subject: [PATCH] FEAT #25 refactoring status

---
 .../statuses-administration.component.html    |   2 +-
 .../status-administration.component.js        |   2 +-
 .../status-administration.component.ts        |   2 +-
 .../statuses-administration.component.js      |   2 +-
 .../statuses-administration.component.ts      |   2 +-
 composer.json                                 |   1 +
 core/Controllers/ActionController.php         |   2 +-
 core/Controllers/ResController.php            |   2 +-
 core/Controllers/StatusController.php         | 267 ------------------
 core/Models/StatusImagesModel.php             |  21 --
 core/Models/StatusImagesModelAbstract.php     |  30 --
 core/Models/StatusModel.php                   |  21 --
 core/Models/StatusModelAbstract.php           | 107 -------
 core/Test/StatusControllerTest.php            |   7 +-
 .../Models/NotificationModelAbstract.php      |   4 +-
 rest/index.php                                |  13 +-
 .../status/controllers/StatusController.php   |  22 +-
 src/app/status/models/StatusModelAbstract.php |   1 -
 18 files changed, 30 insertions(+), 478 deletions(-)
 delete mode 100755 core/Controllers/StatusController.php
 delete mode 100755 core/Models/StatusImagesModel.php
 delete mode 100755 core/Models/StatusImagesModelAbstract.php
 delete mode 100755 core/Models/StatusModel.php
 delete mode 100755 core/Models/StatusModelAbstract.php

diff --git a/apps/maarch_entreprise/Views/statuses-administration.component.html b/apps/maarch_entreprise/Views/statuses-administration.component.html
index 6b849e6fb47..982495186d7 100755
--- a/apps/maarch_entreprise/Views/statuses-administration.component.html
+++ b/apps/maarch_entreprise/Views/statuses-administration.component.html
@@ -50,4 +50,4 @@
             </tbody>
         </table>
     </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.js
index dcae5a20136..3bbb2e9c150 100755
--- a/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.js
+++ b/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.js
@@ -75,7 +75,7 @@ var StatusAdministrationComponent = /** @class */ (function () {
     };
     StatusAdministrationComponent.prototype.getStatusInfos = function (statusIdentifier) {
         var _this = this;
-        this.http.get(this.coreUrl + 'rest/administration/status/' + statusIdentifier)
+        this.http.get(this.coreUrl + 'rest/status/' + statusIdentifier)
             .subscribe(function (data) {
             _this.status = data['status'][0];
             if (_this.status.can_be_searched == 'Y') {
diff --git a/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.ts
index 3720d1fb3e5..d4809e15d2e 100755
--- a/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/status-administration.component.ts
@@ -80,7 +80,7 @@ export class StatusAdministrationComponent implements OnInit {
     }
 
     getStatusInfos(statusIdentifier : string){
-        this.http.get(this.coreUrl + 'rest/administration/status/'+statusIdentifier)
+        this.http.get(this.coreUrl + 'rest/status/'+statusIdentifier)
             .subscribe((data) => {
                 this.status    = data['status'][0];
                 if(this.status.can_be_searched == 'Y'){
diff --git a/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.js
index ec2ce6e2ded..6924cbd4c52 100755
--- a/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.js
+++ b/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.js
@@ -26,7 +26,7 @@ var StatusesAdministrationComponent = /** @class */ (function () {
         this.coreUrl = angularGlobals.coreUrl;
         this.prepareStatus();
         this.loading = true;
-        this.http.get(this.coreUrl + 'rest/administration/status')
+        this.http.get(this.coreUrl + 'rest/status')
             .subscribe(function (data) {
             _this.statusList = data.statusList;
             _this.data = _this.statusList;
diff --git a/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.ts
index 27a6d1011d0..8843c3bf7d8 100755
--- a/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/statuses-administration.component.ts
@@ -34,7 +34,7 @@ export class StatusesAdministrationComponent implements OnInit {
 
         this.loading = true;
 
-        this.http.get(this.coreUrl + 'rest/administration/status')
+        this.http.get(this.coreUrl + 'rest/status')
             .subscribe((data : any) => {
                 this.statusList = data.statusList;
                 this.data = this.statusList; 
diff --git a/composer.json b/composer.json
index 9adc785c64e..659ae8bbe7e 100755
--- a/composer.json
+++ b/composer.json
@@ -4,6 +4,7 @@
             "Basket\\"        : "src/app/basket/",
             "Contact\\"       : "src/app/contact/",
             "History\\"       : "src/app/history/",
+            "Status\\"        : "src/app/status/",
 
             "Core\\"          : "core/",
     	    "Apps\\"          : "apps/maarch_entreprise/",
diff --git a/core/Controllers/ActionController.php b/core/Controllers/ActionController.php
index d3f10816014..f0b0db21596 100644
--- a/core/Controllers/ActionController.php
+++ b/core/Controllers/ActionController.php
@@ -15,7 +15,7 @@ use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
 use Respect\Validation\Validator;
 use Core\Models\ActionModel;
-use Core\Models\StatusModel;
+use Status\models\StatusModel;
 use Core\Models\LangModel;
 
 class ActionController
diff --git a/core/Controllers/ResController.php b/core/Controllers/ResController.php
index 4948a060206..8ed4caf07bb 100755
--- a/core/Controllers/ResController.php
+++ b/core/Controllers/ResController.php
@@ -16,7 +16,7 @@
 namespace Core\Controllers;
 
 use Core\Models\ServiceModel;
-use Core\Models\StatusModel;
+use Status\models\StatusModel;
 use History\controllers\HistoryController;
 use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
diff --git a/core/Controllers/StatusController.php b/core/Controllers/StatusController.php
deleted file mode 100755
index 3f787b47181..00000000000
--- a/core/Controllers/StatusController.php
+++ /dev/null
@@ -1,267 +0,0 @@
-<?php
-
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-*
-*/
-
-/**
-* @brief Status Controller
-* @author dev@maarch.org
-* @ingroup core
-*/
-
-namespace Core\Controllers;
-
-use History\controllers\HistoryController;
-use Psr\Http\Message\RequestInterface;
-use Psr\Http\Message\ResponseInterface;
-use Respect\Validation\Validator;
-use Core\Models\StatusModel;
-use Core\Models\StatusImagesModel;
-use Core\Models\ServiceModel;
-
-class StatusController
-{
-    public function getList(RequestInterface $request, ResponseInterface $response)
-    {
-        if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
-            return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
-        }
-
-        return $response->withJson([
-            'statusList' => StatusModel::getList()
-        ]);
-    }
-
-    public function getNewInformations(RequestInterface $request, ResponseInterface $response)
-    {
-        if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
-            return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
-        }
-
-        return $response->withJson([
-            'statusImages' => StatusImagesModel::getStatusImages()
-        ]);
-    }
-
-    public function getByIdentifier(RequestInterface $request, ResponseInterface $response, $aArgs)
-    {
-        if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
-            return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
-        }
-
-        if (!empty($aArgs['identifier']) && Validator::numeric()->validate($aArgs['identifier'])) {
-            $obj = StatusModel::getByIdentifier(['identifier' => $aArgs['identifier']]);
-
-            if (empty($obj)) {
-                return $response->withStatus(404)->withJson(['errors' => 'identifier not found']);
-            }
-
-            return $response->withJson([
-                'status'       => $obj,
-                'statusImages' => StatusImagesModel::getStatusImages(),
-            ]);
-        } else {
-            return $response->withStatus(500)->withJson(['errors' => 'identifier not valid']);
-        }
-    }
-
-    public function create(RequestInterface $request, ResponseInterface $response)
-    {
-        if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
-            return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
-        }
-
-        $request = $request->getParams();
-        $aArgs   = self::manageValue($request);
-        $errors  = $this->control($aArgs, 'create');
-
-        if (!empty($errors)) {
-            return $response->withStatus(500)->withJson(['errors' => $errors]);
-        }
-
-        if (StatusModel::create($aArgs)) {
-            $return['status'] = StatusModel::getById(['id' => $aArgs['id']])[0];
-
-            HistoryController::add([
-                'tableName' => 'status',
-                'recordId'  => $return['status']['id'],
-                'eventType' => 'ADD',
-                'eventId'   => 'statusup',
-                'info'       => _STATUS_ADDED . ' : ' . $return['status']['id']
-            ]);
-
-            return $response->withJson($return);
-        } else {
-            return $response->withStatus(500)->withJson(['errors' => _NOT_CREATE]);
-        }
-    }
-
-    public function update(RequestInterface $request, ResponseInterface $response, $aArgs)
-    {
-        if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
-            return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
-        }
-
-        $request = $request->getParams();
-        $request = array_merge($request, $aArgs);
-
-        $aArgs   = self::manageValue($request);
-        $errors  = $this->control($aArgs, 'update');
-
-        if (!empty($errors)) {
-            return $response->withStatus(500)->withJson(['errors' => $errors]);
-        }
-
-        if (StatusModel::update($aArgs)) {
-            $return['status'] = StatusModel::getByIdentifier(['identifier' => $aArgs['identifier']])[0];
-
-            HistoryController::add([
-                'tableName' => 'status',
-                'recordId'  => $return['status']['id'],
-                'eventType' => 'UP',
-                'eventId'   => 'statusup',
-                'info'       => _MODIFY_STATUS . ' : ' . $return['status']['id']
-            ]);
-            
-            return $response->withJson($return);
-        } else {
-            return $response
-                ->withStatus(500)
-                ->withJson(['errors' => _NOT_UPDATE]);
-        }
-
-    }
-
-    public function delete(RequestInterface $request, ResponseInterface $response, $aArgs)
-    {
-        if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
-            return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
-        }
-
-        $statusDeleted = StatusModel::getByIdentifier(['identifier' => $aArgs['identifier']]);
-
-        if (Validator::notEmpty()->validate($aArgs['identifier']) && Validator::numeric()->validate($aArgs['identifier']) && !empty($statusDeleted)) {
-            
-            StatusModel::delete(['identifier' => $aArgs['identifier']]);
-
-            HistoryController::add([
-                'tableName' => 'status',
-                'recordId'  => $statusDeleted[0]['id'],
-                'eventType' => 'DEL',
-                'eventId'   => 'statusdel',
-                'info'       => _STATUS_DELETED . ' : ' . $statusDeleted[0]['id']
-            ]);
-        } else {
-            return $response
-                ->withStatus(500)
-                ->withJson(['errors' => 'identifier not valid']);
-        }
-
-        return $response->withJson(
-            [
-            'statuses' => StatusModel::getList()
-            ]
-        );
-    }
-
-    protected function manageValue($request)
-    {
-        foreach ($request  as $key => $value) {
-            if (in_array($key, ['is_system', 'is_folder_status', 'can_be_searched', 'can_be_modified'])) {
-                if (empty($value)) {
-                    $request[$key] = 'N';
-                } else {
-                    $request[$key] = 'Y';
-                }
-            }
-        }
-
-        $request['is_system'] = 'N';
-
-        return $request;
-    }
-
-    protected function control($request, $mode)
-    {
-        $errors = [];
-
-        if(!Validator::notEmpty()->validate($request['id'])){
-            array_push($errors, _ID . ' ' . _EMPTY);
-        } else if ($mode == 'create') {
-            $obj = StatusModel::getById(['id' => $request['id']]);
-
-            if (!empty($obj)) {
-                array_push(
-                    $errors,
-                    _ID . ' ' . $obj[0]['id'] . ' ' . _ALREADY_EXISTS
-                );
-            }
-        } elseif ($mode == 'update') {
-            $obj = StatusModel::getByIdentifier(['identifier' => $request['identifier']]);
-            
-            if (empty($obj)) {
-                array_push(
-                    $errors,
-                    $request['identifier'] . ' ' . _NOT_EXISTS
-                );
-            }
-        }
-
-        if (!Validator::regex('/^[\w.-]*$/')->validate($request['id']) ||
-            !Validator::length(1, 10)->validate($request['id']) ||
-            !Validator::notEmpty()->validate($request['id'])) {
-            array_push($errors, _ID . ' ' . _INVALID);
-        }
-
-        if (!Validator::notEmpty()->validate($request['label_status']) ||
-            !Validator::length(1, 50)->validate($request['label_status'])) {
-            array_push($errors, _DESCRIPTION . ' ' . _INVALID);
-        }
-
-        if (Validator::notEmpty()->validate($request['is_system']) &&
-            !Validator::contains('Y')->validate($request['is_system']) &&
-            !Validator::contains('N')->validate($request['is_system'])
-        ) {
-            array_push($errors, 'is_system ' . _INVALID);
-        }
-
-        if (Validator::notEmpty()->validate($request['is_folder_status']) &&
-            !Validator::contains('Y')->validate($request['is_folder_status']) &&
-            !Validator::contains('N')->validate($request['is_folder_status'])
-        ) {
-            array_push($errors, _IS_FOLDER_STATUS . ' ' . _INVALID);
-        }
-
-        if (!Validator::notEmpty()->validate($request['img_filename']) ||
-            !Validator::length(1, 255)->validate($request['img_filename'])
-        ) {
-            array_push($errors, _IMG_RELATED . ' ' . _INVALID);
-        }
-
-        if (Validator::notEmpty()->validate($request['maarch_module']) &&
-            !Validator::length(null, 255)->validate($request['maarch_module'])
-        ) {
-            array_push($errors, 'maarch_module ' . _INVALID);
-        }
-
-        if (Validator::notEmpty()->validate($request['can_be_searched']) &&
-            !Validator::contains('Y')->validate($request['can_be_searched']) &&
-            !Validator::contains('N')->validate($request['can_be_searched'])
-        ) {
-            array_push($errors, _CAN_BE_SEARCHED . ' ' . _INVALID);
-        }
-
-        if (Validator::notEmpty()->validate($request['can_be_modified']) &&
-            !Validator::contains('Y')->validate($request['can_be_modified']) &&
-            !Validator::contains('N')->validate($request['can_be_modified'])
-        ) {
-            array_push($errors, _CAN_BE_MODIFIED . ' ' . _INVALID);
-        }
-
-        return $errors;
-    }
-}
diff --git a/core/Models/StatusImagesModel.php b/core/Models/StatusImagesModel.php
deleted file mode 100755
index 16947e5907b..00000000000
--- a/core/Models/StatusImagesModel.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-*
-*/
-
-/**
-* @brief Status Images Model
-* @author dev@maarch.org
-* @ingroup core
-*/
-
-namespace Core\Models;
-
-class StatusImagesModel extends StatusImagesModelAbstract
-{
-    // Do your stuff in this class
-}
diff --git a/core/Models/StatusImagesModelAbstract.php b/core/Models/StatusImagesModelAbstract.php
deleted file mode 100755
index 3ddfdac8f67..00000000000
--- a/core/Models/StatusImagesModelAbstract.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-*
-*/
-
-/**
-* @brief Status Images Model
-* @author dev@maarch.org
-* @ingroup core
-*/
-
-namespace Core\Models;
-
-class StatusImagesModelAbstract
-{
-    public static function getStatusImages(array $aArgs = [])
-    {
-        $aReturn = DatabaseModel::select([
-            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
-            'table'     => ['status_images'],
-            'order_by'  => ['id']
-        ]);
-
-        return $aReturn;
-    }
-}
diff --git a/core/Models/StatusModel.php b/core/Models/StatusModel.php
deleted file mode 100755
index eb02f938265..00000000000
--- a/core/Models/StatusModel.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-*
-*/
-
-/**
-* @brief Status Model
-* @author dev@maarch.org
-* @ingroup core
-*/
-
-namespace Core\Models;
-
-class StatusModel extends StatusModelAbstract
-{
-    // Do your stuff in this class
-}
diff --git a/core/Models/StatusModelAbstract.php b/core/Models/StatusModelAbstract.php
deleted file mode 100755
index 9dbb3903673..00000000000
--- a/core/Models/StatusModelAbstract.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-*
-*/
-
-/**
-* @brief Status Model
-* @author dev@maarch.org
-* @ingroup core
-*/
-
-namespace Core\Models;
-
-class StatusModelAbstract
-{
-    public static function getList()
-    {
-        $aReturn = DatabaseModel::select([
-            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
-            'table'     => ['status'],
-            'order_by'  => ['identifier']
-        ]);
-
-        return $aReturn;
-    }
-
-    public static function getById(array $aArgs = [])
-    {
-        ValidatorModel::notEmpty($aArgs, ['id']);
-        ValidatorModel::stringType($aArgs, ['id']);
-
-        $aReturn = DatabaseModel::select([
-            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
-            'table'     => ['status'],
-            'where'     => ['id = ?'],
-            'data'      => [$aArgs['id']]
-        ]);
-
-        return $aReturn;
-    }
-
-    public static function getByIdentifier(array $aArgs = [])
-    {
-        ValidatorModel::notEmpty($aArgs, ['identifier']);
-        ValidatorModel::intVal($aArgs, ['identifier']);
-
-        $aReturn = DatabaseModel::select([
-            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
-            'table'     => ['status'],
-            'where'     => ['identifier = ?'],
-            'data'      => [$aArgs['identifier']]
-        ]);
-
-        return $aReturn;
-    }
-
-    public static function create(array $aArgs = [])
-    {
-        ValidatorModel::notEmpty($aArgs, ['id', 'label_status']);
-        ValidatorModel::stringType($aArgs, ['id', 'label_status']);
-
-        $aReturn = DatabaseModel::insert([
-            'table'         => 'status',
-            'columnsValues' => $aArgs
-            ]);
-
-        return $aReturn;
-    }
-
-    public static function update(array $aArgs = [])
-    {
-        ValidatorModel::notEmpty($aArgs, ['label_status', 'identifier']);
-        ValidatorModel::intVal($aArgs, ['identifier']);
-
-        $where['identifier'] = $aArgs['identifier'];
-        unset($aArgs['id']);
-        unset($aArgs['identifier']);
-
-        $aReturn = DatabaseModel::update([
-            'table' => 'status',
-            'set'   => $aArgs,
-            'where' => ['identifier = ?'],
-            'data'  => [$where['identifier']]
-        ]);
-
-        return $aReturn;
-    }
-
-    public static function delete(array $aArgs = [])
-    {
-        ValidatorModel::notEmpty($aArgs, ['identifier']);
-        ValidatorModel::intVal($aArgs, ['identifier']);
-
-        $aReturn = DatabaseModel::delete([
-                'table' => 'status',
-                'where' => ['identifier = ?'],
-                'data'  => [$aArgs['identifier']]
-            ]);
-
-        return $aReturn;
-    }
-
-}
diff --git a/core/Test/StatusControllerTest.php b/core/Test/StatusControllerTest.php
index 09e56ca0d5d..db31a7969a3 100755
--- a/core/Test/StatusControllerTest.php
+++ b/core/Test/StatusControllerTest.php
@@ -8,6 +8,7 @@
 */
 
 namespace MaarchTest;
+
 use PHPUnit\Framework\TestCase;
 
 class StatusControllerTest extends TestCase
@@ -16,7 +17,7 @@ class StatusControllerTest extends TestCase
     {
         $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'POST']);
         $request     = \Slim\Http\Request::createFromEnvironment($environment);
-        $status      = new \Core\Controllers\StatusController();
+        $status      = new \Status\controllers\StatusController();
 
         $aArgs = [
             'id'               => 'TEST',
@@ -85,7 +86,7 @@ class StatusControllerTest extends TestCase
         ########## GET LIST ##########
         $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']);
         $request     = \Slim\Http\Request::createFromEnvironment($environment);
-        $status      = new \Core\Controllers\StatusController();
+        $status      = new \Status\controllers\StatusController();
 
         $response  = $status->getList($request, new \Slim\Http\Response());
 
@@ -192,7 +193,7 @@ class StatusControllerTest extends TestCase
     {
         $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']);
         $request     = \Slim\Http\Request::createFromEnvironment($environment);
-        $status      = new \Core\Controllers\StatusController();
+        $status      = new \Status\controllers\StatusController();
 
         $response = $status->getNewInformations($request, new \Slim\Http\Response());
 
diff --git a/modules/notifications/Models/NotificationModelAbstract.php b/modules/notifications/Models/NotificationModelAbstract.php
index 22fd1ffd6d5..b1fe87c7096 100644
--- a/modules/notifications/Models/NotificationModelAbstract.php
+++ b/modules/notifications/Models/NotificationModelAbstract.php
@@ -17,7 +17,7 @@ namespace Notifications\Models;
 
 use Core\Models\DatabaseModel;
 use Core\Models\ValidatorModel;
-use Core\Models\StatusModelAbstract;
+use Status\models\StatusModel;
 use Entities\Models\EntityModelAbstract;
 use Core\Models\GroupModelAbstract;
 
@@ -321,7 +321,7 @@ class NotificationModelAbstract
 
     public static function getDiffusionTypeStatus()
     {
-        $status = StatusModelAbstract::getList();
+        $status = StatusModel::getList();
         return $status;
     }
 
diff --git a/rest/index.php b/rest/index.php
index 15e336aa2e0..f5c35986416 100755
--- a/rest/index.php
+++ b/rest/index.php
@@ -131,9 +131,12 @@ $app->get('/sortedBaskets', \Basket\controllers\BasketController::class . ':getS
 $app->put('/sortedBaskets/{id}', \Basket\controllers\BasketController::class . ':updateSort');
 
 //status
-$app->get('/administration/status', \Core\Controllers\StatusController::class . ':getList');
-$app->get('/administration/status/new', \Core\Controllers\StatusController::class . ':getNewInformations');
-$app->get('/administration/status/{identifier}', \Core\Controllers\StatusController::class . ':getByIdentifier');
+$app->get('/status', \Status\controllers\StatusController::class . ':getList');
+$app->get('/administration/status/new', \Status\controllers\StatusController::class . ':getNewInformations');
+$app->get('/status/{identifier}', \Status\controllers\StatusController::class . ':getByIdentifier');
+$app->post('/status', \Status\controllers\StatusController::class . ':create');
+$app->put('/status/{identifier}', \Status\controllers\StatusController::class . ':update');
+$app->delete('/status/{identifier}', \Status\controllers\StatusController::class . ':delete');
 
 //groups
 $app->get('/groups', \Core\Controllers\GroupController::class . ':get');
@@ -144,10 +147,6 @@ $app->get('/groups/{id}/details', \Core\Controllers\GroupController::class . ':g
 $app->put('/groups/{id}/services/{serviceId}', \Core\Controllers\GroupController::class . ':updateService');
 $app->put('/groups/{id}/reassign/{newGroupId}', \Core\Controllers\GroupController::class . ':reassignUsers');
 
-//status
-$app->post('/status', \Core\Controllers\StatusController::class . ':create');
-$app->put('/status/{identifier}', \Core\Controllers\StatusController::class . ':update');
-$app->delete('/status/{identifier}', \Core\Controllers\StatusController::class . ':delete');
 
 //Docservers
 $app->get('/docservers', \Core\Controllers\DocserverController::class . ':get');
diff --git a/src/app/status/controllers/StatusController.php b/src/app/status/controllers/StatusController.php
index dcf9b149364..1baa1f1381b 100644
--- a/src/app/status/controllers/StatusController.php
+++ b/src/app/status/controllers/StatusController.php
@@ -16,16 +16,16 @@
 namespace Status\controllers;
 
 use History\controllers\HistoryController;
-use Psr\Http\Message\RequestInterface;
-use Psr\Http\Message\ResponseInterface;
 use Respect\Validation\Validator;
 use Status\models\StatusModel;
 use Status\models\StatusImagesModel;
 use Core\Models\ServiceModel;
+use Slim\Http\Request;
+use Slim\Http\Response;
 
 class StatusController
 {
-    public function getList(RequestInterface $request, ResponseInterface $response)
+    public function getList(Request $request, Response $response)
     {
         if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
             return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
@@ -36,7 +36,7 @@ class StatusController
         ]);
     }
 
-    public function getNewInformations(RequestInterface $request, ResponseInterface $response)
+    public function getNewInformations(Request $request, Response $response)
     {
         if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
             return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
@@ -47,7 +47,7 @@ class StatusController
         ]);
     }
 
-    public function getByIdentifier(RequestInterface $request, ResponseInterface $response, $aArgs)
+    public function getByIdentifier(Request $request, Response $response, $aArgs)
     {
         if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
             return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
@@ -69,7 +69,7 @@ class StatusController
         }
     }
 
-    public function create(RequestInterface $request, ResponseInterface $response)
+    public function create(Request $request, Response $response)
     {
         if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
             return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
@@ -100,7 +100,7 @@ class StatusController
         }
     }
 
-    public function update(RequestInterface $request, ResponseInterface $response, $aArgs)
+    public function update(Request $request, Response $response, $aArgs)
     {
         if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
             return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
@@ -133,10 +133,9 @@ class StatusController
                 ->withStatus(500)
                 ->withJson(['errors' => _NOT_UPDATE]);
         }
-
     }
 
-    public function delete(RequestInterface $request, ResponseInterface $response, $aArgs)
+    public function delete(Request $request, Response $response, $aArgs)
     {
         if (!ServiceModel::hasService(['id' => 'admin_status', 'userId' => $_SESSION['user']['UserId'], 'location' => 'apps', 'type' => 'admin'])) {
             return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
@@ -145,7 +144,6 @@ class StatusController
         $statusDeleted = StatusModel::getByIdentifier(['identifier' => $aArgs['identifier']]);
 
         if (Validator::notEmpty()->validate($aArgs['identifier']) && Validator::numeric()->validate($aArgs['identifier']) && !empty($statusDeleted)) {
-            
             StatusModel::delete(['identifier' => $aArgs['identifier']]);
 
             HistoryController::add([
@@ -189,9 +187,9 @@ class StatusController
     {
         $errors = [];
 
-        if(!Validator::notEmpty()->validate($request['id'])){
+        if (!Validator::notEmpty()->validate($request['id'])) {
             array_push($errors, _ID . ' ' . _EMPTY);
-        } else if ($mode == 'create') {
+        } elseif ($mode == 'create') {
             $obj = StatusModel::getById(['id' => $request['id']]);
 
             if (!empty($obj)) {
diff --git a/src/app/status/models/StatusModelAbstract.php b/src/app/status/models/StatusModelAbstract.php
index 352ad42a277..0b116f7376f 100644
--- a/src/app/status/models/StatusModelAbstract.php
+++ b/src/app/status/models/StatusModelAbstract.php
@@ -106,5 +106,4 @@ class StatusModelAbstract
 
         return $aReturn;
     }
-
 }
-- 
GitLab