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