From d0c4eb615a1fd45eb3ad5ac61e94a1d9cab27c8a Mon Sep 17 00:00:00 2001 From: Daniel Klabbers Date: Wed, 3 Nov 2021 11:24:30 +0100 Subject: [PATCH] add indexing endpoint --- extend.php | 3 ++- src/Api/Controllers/IndexController.php | 30 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/Api/Controllers/IndexController.php diff --git a/extend.php b/extend.php index 8ec76e9..012f9e6 100644 --- a/extend.php +++ b/extend.php @@ -15,7 +15,8 @@ return [ (new Flarum\Locales(__DIR__ . '/resources/locale')), (new Flarum\Routes('api')) - ->get('/blomstra/search/{type}', 'blomstra.search', Api\Controllers\SearchController::class), + ->get('/blomstra/search/{type}', 'blomstra.search', Api\Controllers\SearchController::class) + ->put('/blomstra/search/index', 'blomstra.search.index', Api\Controllers\IndexController::class), (new Flarum\Console) ->command(Commands\BuildCommand::class) diff --git a/src/Api/Controllers/IndexController.php b/src/Api/Controllers/IndexController.php new file mode 100644 index 0000000..573ce8c --- /dev/null +++ b/src/Api/Controllers/IndexController.php @@ -0,0 +1,30 @@ +getAttribute('actor'); + $actor->assertAdmin(); + + /** @var BuildCommand $command */ + $command = resolve(BuildCommand::class); + + $command->run( + new ArrayInput([]), + new ConsoleOutput); + + return new EmptyResponse(); + } +}