repod/lib/Controller/SearchController.php

32 lines
795 B
PHP
Raw Normal View History

2023-07-25 23:26:46 +00:00
<?php
declare(strict_types=1);
namespace OCA\RePod\Controller;
use OCA\RePod\AppInfo\Application;
2024-01-18 10:43:58 +00:00
use OCA\RePod\Service\MultiPodService;
2023-07-25 23:26:46 +00:00
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
2023-07-25 23:26:46 +00:00
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
class SearchController extends Controller
{
public function __construct(
IRequest $request,
2024-01-18 10:43:58 +00:00
private MultiPodService $multiPodService
2023-07-25 23:26:46 +00:00
) {
parent::__construct(Application::APP_ID, $request);
}
#[NoAdminRequired]
#[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/search')]
public function index(string $q): JSONResponse {
return new JSONResponse($this->multiPodService->search($q));
2023-07-25 23:26:46 +00:00
}
}