Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
fix: modify user controller hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark2000 committed Mar 26, 2024
1 parent a3e81ec commit 91ba4f1
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions backend/app/src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,6 @@ export class UserController {
}
}

@Roles(Role.Admin)
@Put(':userId')
async updateUser(
@Param('userId', ParseIntPipe) userId: number,
@Body() userDTO: UpdateUserDTO,
@Req() req: AuthenticatedRequest
): Promise<ReducedUserDTO> {
try {
return await this.userService.updateUser(req.user.id, userId, userDTO)
} catch (error) {
BusinessExceptionHandler(error)
}
}

@Put('profile-image')
@UseInterceptors(FileInterceptor('image', IMAGE_OPTIONS))
async updateCurrentUserProfileImage(
Expand All @@ -118,6 +104,20 @@ export class UserController {
}
}

@Roles(Role.Admin)
@Put(':userId')
async updateUser(
@Param('userId', ParseIntPipe) userId: number,
@Body() userDTO: UpdateUserDTO,
@Req() req: AuthenticatedRequest
): Promise<ReducedUserDTO> {
try {
return await this.userService.updateUser(req.user.id, userId, userDTO)
} catch (error) {
BusinessExceptionHandler(error)
}
}

@Roles(Role.Admin)
@Post('temp')
async createTempUser(
Expand Down

0 comments on commit 91ba4f1

Please sign in to comment.