public function __construct($app)
 {
     $this->app = $app;
     $app->group('/fitting-rule', function () use($app) {
         $restService = new \Core\Service\RestService($app);
         $fittingRuleService = new \Core\Service\FittingRuleService();
         $restService->get('/calculate', function () use($fittingRuleService) {
             return $fittingRuleService->calculateNewItemFilterTypes();
         });
         $restService->get('/check', function () use($fittingRuleService) {
             return $fittingRuleService->check($_GET['name'], isset($_GET['cid']) ? intval($_GET['cid']) : null);
         });
         $restService->get('/autocomplete', function () use($fittingRuleService) {
             return $fittingRuleService->getAutocomplete($_GET['s']);
         });
         $restService->get('/list', function () use($fittingRuleService) {
             return $fittingRuleService->getList($_GET['type'], intval($_GET['page']));
         });
         $restService->get('/:id', function ($id) use($fittingRuleService) {
             return $fittingRuleService->get($id);
         });
         $restService->post('/', function () use($fittingRuleService) {
             $data = getPost();
             return $fittingRuleService->save($data);
         });
         $restService->delete('/:id', function ($id) use($fittingRuleService) {
             return $fittingRuleService->delete($id);
         });
         $restService->post('/fork', function () use($fittingRuleService) {
             $data = getPost();
             return $fittingRuleService->fork($data);
         });
     });
 }
 public function __construct($app)
 {
     $this->app = $app;
     $app->group('/composition', function () use($app) {
         $restService = new \Core\Service\RestService($app);
         $compositionService = new \Core\Service\CompositionService();
         $restService->get('/check', function () use($compositionService) {
             return $compositionService->check($_GET['name'], isset($_GET['cid']) ? intval($_GET['cid']) : null);
         });
         $restService->get('/autocomplete', function () use($compositionService) {
             return $compositionService->getAutocomplete($_GET['s']);
         });
         $restService->get('/list', function () use($compositionService) {
             return $compositionService->getList($_GET['type'], intval($_GET['page']));
         });
         $restService->get('/:id', function ($id) use($compositionService) {
             return $compositionService->get($id);
         });
         $restService->post('/', function () use($compositionService) {
             $data = getPost();
             return $compositionService->save($data);
         });
         $restService->delete('/:id', function ($id) use($compositionService) {
             return $compositionService->delete($id);
         });
         $restService->post('/fork', function () use($compositionService) {
             $data = getPost();
             return $compositionService->fork($data);
         });
     });
 }
 public function __construct($app)
 {
     $this->app = $app;
     $app->group('/account-settings', function () use($app) {
         $restService = new \Core\Service\RestService($app);
         $accountSettingsService = new \Core\Service\AccountSettingsService();
         $restService->get('/', function () use($accountSettingsService) {
             return $accountSettingsService->get(0);
         });
         $restService->post('/', function () use($accountSettingsService) {
             $data = getPost();
             return $accountSettingsService->save($data);
         });
     });
 }