currentUserId = $userId; } /** * @psalm-return JSONResponse<200|404, array, array> */ #[Route(Route::TYPE_FRONTPAGE, verb: 'GET', url: '/api/filter/{accountId}', requirements: ['accountId' => '[\d]+'])] #[NoAdminRequired] public function getFilters(int $accountId): JSONResponse { $account = $this->accountService->findById($accountId); if ($account->getUserId() !== $this->currentUserId) { return new JSONResponse([], Http::STATUS_NOT_FOUND); } $result = $this->mailFilterService->parse($account->getMailAccount()); return new JSONResponse($result->getFilters()); } /** * @psalm-return JSONResponse<200|404, array, array> */ #[Route(Route::TYPE_FRONTPAGE, verb: 'PUT', url: '/api/filter/{accountId}', requirements: ['accountId' => '[\d]+'])] #[NoAdminRequired] public function updateFilters(int $accountId, array $filters): JSONResponse { $account = $this->accountService->findById($accountId); if ($account->getUserId() !== $this->currentUserId) { return new JSONResponse([], Http::STATUS_NOT_FOUND); } $this->mailFilterService->update($account->getMailAccount(), $filters); return new JSONResponse([]); } }