diff --git a/api/src/controllers/auth.controller.ts b/api/src/controllers/auth.controller.ts index 73fdd5cfac..5d07bb1d3d 100644 --- a/api/src/controllers/auth.controller.ts +++ b/api/src/controllers/auth.controller.ts @@ -30,11 +30,13 @@ import { Login } from '../dtos/auth/login.dto'; import { mapTo } from '../utilities/mapTo'; import { User } from '../dtos/users/user.dto'; import { LoginViaSingleUseCode } from '../dtos/auth/login-single-use-code.dto'; +import { ApiKeyGuard } from '../guards/api-key.guard'; import { SingleUseCodeAuthGuard } from '../guards/single-use-code.guard'; @Controller('auth') @ApiTags('auth') @UsePipes(new ValidationPipe(defaultValidationPipeOptions)) +@UseGuards(ApiKeyGuard) export class AuthController { constructor(private readonly authService: AuthService) {} diff --git a/api/src/controllers/lottery.controller.ts b/api/src/controllers/lottery.controller.ts index b796075ccd..301e512b0a 100644 --- a/api/src/controllers/lottery.controller.ts +++ b/api/src/controllers/lottery.controller.ts @@ -100,7 +100,6 @@ export class LotteryController { @ActivityLogMetadata([ { targetPropertyName: 'lotteryStatus', propertyPath: 'lotteryStatus' }, ]) - @UseGuards(ApiKeyGuard) async lotteryStatus( @Request() req: ExpressRequest, @Body() dto: ListingLotteryStatus, diff --git a/api/src/controllers/script-runner.controller.ts b/api/src/controllers/script-runner.controller.ts index 8674df17e7..885d2e60ad 100644 --- a/api/src/controllers/script-runner.controller.ts +++ b/api/src/controllers/script-runner.controller.ts @@ -16,14 +16,14 @@ import { OptionalAuthGuard } from '../guards/optional.guard'; import { AdminOrJurisdictionalAdminGuard } from '../guards/admin-or-jurisdiction-admin.guard'; import { DataTransferDTO } from '../dtos/script-runner/data-transfer.dto'; import { BulkApplicationResendDTO } from '../dtos/script-runner/bulk-application-resend.dto'; -import { IdDTO } from '../dtos/shared/id.dto'; import { AmiChartImportDTO } from '../dtos/script-runner/ami-chart-import.dto'; import { CommunityTypeDTO } from '../dtos/script-runner/community-type.dto'; +import { ApiKeyGuard } from '../guards/api-key.guard'; @Controller('scriptRunner') @ApiTags('scriptRunner') @UsePipes(new ValidationPipe(defaultValidationPipeOptions)) -@UseGuards(OptionalAuthGuard, AdminOrJurisdictionalAdminGuard) +@UseGuards(ApiKeyGuard, OptionalAuthGuard, AdminOrJurisdictionalAdminGuard) export class ScirptRunnerController { constructor(private readonly scriptRunnerService: ScriptRunnerService) {} diff --git a/api/test/unit/utilities/custom-exception-filter.spec.ts b/api/test/integration/custom-exception-filter.e2e-spec.ts similarity index 85% rename from api/test/unit/utilities/custom-exception-filter.spec.ts rename to api/test/integration/custom-exception-filter.e2e-spec.ts index f64d100c6a..73bff995af 100644 --- a/api/test/unit/utilities/custom-exception-filter.spec.ts +++ b/api/test/integration/custom-exception-filter.e2e-spec.ts @@ -2,9 +2,9 @@ import { HttpAdapterHost } from '@nestjs/core'; import { Test, TestingModule } from '@nestjs/testing'; import { INestApplication, Logger } from '@nestjs/common'; import request from 'supertest'; -import { AppModule } from '../../../src/modules/app.module'; -import { PrismaService } from '../../../src/services/prisma.service'; -import { CustomExceptionFilter } from '../../../src/utilities/custom-exception-filter'; +import { AppModule } from '../../src/modules/app.module'; +import { PrismaService } from '../../src/services/prisma.service'; +import { CustomExceptionFilter } from '../../src/utilities/custom-exception-filter'; describe('Testing custom exception filter', () => { let app: INestApplication;