Skip to content

Commit

Permalink
reorder cypress routes to ensure delete cypress is read first (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorreem committed Apr 28, 2023
1 parent cae303a commit c30c5d9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export class UserController {
async deleteUser(@Req() req: Request): Promise<string> {
return await this.userService.deleteUser(req['user'] as GetUserDto);
}
// This route must go before the Delete user route below as we want nestjs to check against this one first
@ApiBearerAuth('access-token')
@Delete('/cypress')
@UseGuards(SuperAdminAuthGuard)
async deleteCypressUsers(): Promise<UserEntity[]> {
return await this.userService.deleteCypressTestUsers();
}

@ApiBearerAuth()
@Delete(':id')
Expand All @@ -59,13 +66,6 @@ export class UserController {
return await this.userService.deleteUserById(id);
}

@ApiBearerAuth('access-token')
@Delete('/cypress')
@UseGuards(SuperAdminAuthGuard)
async deleteCypressUsers(): Promise<UserEntity[]> {
return await this.userService.deleteCypressTestUsers();
}

@ApiBearerAuth()
@Put()
@UseGuards(FirebaseAuthGuard)
Expand Down

1 comment on commit c30c5d9

@swetha-charles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful docs

This is related to how express handles routes

Please sign in to comment.