Moved history controller to routes

This commit is contained in:
Marcin Kurczewski 2014-11-21 10:33:15 +01:00
parent a11436aa8c
commit 7ff961fc21
2 changed files with 12 additions and 7 deletions

View file

@ -1,14 +1,14 @@
<?php <?php
namespace Szurubooru\Controllers; namespace Szurubooru\Routes;
use Szurubooru\Controllers\ViewProxies\SnapshotViewProxy; use Szurubooru\Controllers\ViewProxies\SnapshotViewProxy;
use Szurubooru\Helpers\InputReader; use Szurubooru\Helpers\InputReader;
use Szurubooru\Privilege; use Szurubooru\Privilege;
use Szurubooru\Router; use Szurubooru\Routes\AbstractRoute;
use Szurubooru\SearchServices\Parsers\SnapshotSearchParser; use Szurubooru\SearchServices\Parsers\SnapshotSearchParser;
use Szurubooru\Services\HistoryService; use Szurubooru\Services\HistoryService;
use Szurubooru\Services\PrivilegeService; use Szurubooru\Services\PrivilegeService;
final class HistoryController extends AbstractController class GetHistory extends AbstractRoute
{ {
private $historyService; private $historyService;
private $privilegeService; private $privilegeService;
@ -30,12 +30,17 @@ final class HistoryController extends AbstractController
$this->snapshotViewProxy = $snapshotViewProxy; $this->snapshotViewProxy = $snapshotViewProxy;
} }
public function registerRoutes(Router $router) public function getMethods()
{ {
$router->get('/api/history', [$this, 'getFiltered']); return ['GET'];
} }
public function getFiltered() public function getUrl()
{
return '/api/history';
}
public function work()
{ {
$this->privilegeService->assertPrivilege(Privilege::VIEW_HISTORY); $this->privilegeService->assertPrivilege(Privilege::VIEW_HISTORY);

View file

@ -62,7 +62,6 @@ return [
$container->get(\Szurubooru\Controllers\PostController::class), $container->get(\Szurubooru\Controllers\PostController::class),
$container->get(\Szurubooru\Controllers\PostContentController::class), $container->get(\Szurubooru\Controllers\PostContentController::class),
$container->get(\Szurubooru\Controllers\PostNotesController::class), $container->get(\Szurubooru\Controllers\PostNotesController::class),
$container->get(\Szurubooru\Controllers\HistoryController::class),
$container->get(\Szurubooru\Controllers\ScoreController::class), $container->get(\Szurubooru\Controllers\ScoreController::class),
$container->get(\Szurubooru\Controllers\TagController::class), $container->get(\Szurubooru\Controllers\TagController::class),
]; ];
@ -72,6 +71,7 @@ return [
return [ return [
$container->get(\Szurubooru\Routes\Login::class), $container->get(\Szurubooru\Routes\Login::class),
$container->get(\Szurubooru\Routes\GetGlobals::class), $container->get(\Szurubooru\Routes\GetGlobals::class),
$container->get(\Szurubooru\Routes\GetHistory::class),
$container->get(\Szurubooru\Routes\Comments\AddComment::class), $container->get(\Szurubooru\Routes\Comments\AddComment::class),
$container->get(\Szurubooru\Routes\Comments\EditComment::class), $container->get(\Szurubooru\Routes\Comments\EditComment::class),
$container->get(\Szurubooru\Routes\Comments\DeleteComment::class), $container->get(\Szurubooru\Routes\Comments\DeleteComment::class),