repod/lib/Controller/ToplistController.php
Michel Roux 0024507ed5
All checks were successful
repod / xml (push) Successful in 16s
repod / php (push) Successful in 1m7s
repod / nodejs (push) Successful in 1m29s
repod / release (push) Has been skipped
refactor: 🚚 move routes to PHP anotations
2024-10-18 15:19:45 +02:00

39 lines
961 B
PHP

<?php
declare(strict_types=1);
namespace OCA\RePod\Controller;
use OCA\RePod\AppInfo\Application;
use OCA\RePod\Service\FyydService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
class ToplistController extends Controller
{
public function __construct(
IRequest $request,
private FyydService $fyydService
) {
parent::__construct(Application::APP_ID, $request);
}
#[NoAdminRequired]
#[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/toplist/hot')]
public function hot(): JSONResponse {
return new JSONResponse($this->fyydService->hot());
}
#[NoAdminRequired]
#[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/toplist/new')]
public function new(): JSONResponse {
return new JSONResponse($this->fyydService->latest());
}
}