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;
|
2024-10-18 13:19:45 +00:00
|
|
|
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-11-12 09:11:21 +00:00
|
|
|
private readonly MultiPodService $multiPodService
|
2023-07-25 23:26:46 +00:00
|
|
|
) {
|
|
|
|
parent::__construct(Application::APP_ID, $request);
|
|
|
|
}
|
|
|
|
|
2024-10-18 13:19:45 +00:00
|
|
|
#[NoAdminRequired]
|
|
|
|
#[NoCSRFRequired]
|
|
|
|
#[FrontpageRoute(verb: 'GET', url: '/search')]
|
2024-02-20 20:31:38 +00:00
|
|
|
public function index(string $q): JSONResponse {
|
|
|
|
return new JSONResponse($this->multiPodService->search($q));
|
2023-07-25 23:26:46 +00:00
|
|
|
}
|
|
|
|
}
|