-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 본인 정보 조회에는 id값을 입력 받지 않도록 수정 #158
- Loading branch information
Showing
5 changed files
with
21 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BaseException } from '@src/common/exception/BaseException'; | ||
|
||
export class UserNotFoundException extends BaseException { | ||
constructor(id: number) { | ||
super({ | ||
code: 2001, | ||
message: `id:${id} 사용자를 찾을 수 없습니다.`, | ||
status: 404, | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { Controller, Get, Param, UseGuards } from '@nestjs/common'; | ||
import { Controller, Get, UseGuards } from '@nestjs/common'; | ||
import { UserService } from './user.service'; | ||
import { JwtAuthGuard } from '@src/auth/JwtAuthGuard'; | ||
import { UserPermissionGuard } from '@src/user/guards/UserPermissionGuard'; | ||
import { AuthUser } from '@src/auth/AuthUser.decorator'; | ||
|
||
@Controller('users') | ||
export class UserController { | ||
constructor(private readonly userService: UserService) {} | ||
|
||
@Get('/:id') | ||
@UseGuards(JwtAuthGuard, UserPermissionGuard) | ||
async getUserInfo(@Param('id') id: number) { | ||
return await this.userService.getUserInfo(id); | ||
@Get('/info') | ||
@UseGuards(JwtAuthGuard) | ||
async getUserInfo(@AuthUser() user: AuthUser) { | ||
return await this.userService.getUserInfo(user.userId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters