refactor(public-api): use TokenAuthGuard on controller not method level

As the public api is nearly completely protected by the TokenAuthGuard it seems unnecessarily verbose to add the guard to every method in the controllers, when an annotation at the top of the controller would be sufficient.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-01-17 10:57:50 +01:00
parent d142cbadeb
commit 2bc8c0d6da
3 changed files with 1 additions and 5 deletions

View file

@ -9,7 +9,6 @@ import {
Delete,
Get,
HttpCode,
NotFoundException,
Put,
UseGuards,
UseInterceptors,
@ -24,7 +23,6 @@ import {
} from '@nestjs/swagger';
import { TokenAuthGuard } from '../../../auth/token.strategy';
import { NotInDBError } from '../../../errors/errors';
import { HistoryEntryUpdateDto } from '../../../history/history-entry-update.dto';
import { HistoryEntryDto } from '../../../history/history-entry.dto';
import { HistoryService } from '../../../history/history.service';

View file

@ -21,13 +21,13 @@ import {
unauthorizedDescription,
} from '../../utils/descriptions';
@UseGuards(TokenAuthGuard)
@ApiTags('monitoring')
@ApiSecurity('token')
@Controller('monitoring')
export class MonitoringController {
constructor(private monitoringService: MonitoringService) {}
@UseGuards(TokenAuthGuard)
@Get()
@ApiOkResponse({
description: 'The server info',
@ -40,7 +40,6 @@ export class MonitoringController {
return this.monitoringService.getServerStatus();
}
@UseGuards(TokenAuthGuard)
@Get('prometheus')
@ApiOkResponse({
description: 'Prometheus compatible monitoring data',

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import {
BadRequestException,
Body,
Controller,
Delete,