Skip to content

Commit

Permalink
chore: 로그인 API response에 닉네임 필드 추가 #86
Browse files Browse the repository at this point in the history
  • Loading branch information
feel-coding committed Jul 30, 2023
1 parent 27d8f3d commit e039f86
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/cvsgo/dto/auth/LoginResponseDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ public class LoginResponseDto {

private Long userId;

private String userNickname;

private String accessToken;

private String refreshToken;

private String tokenType;

@Builder
public LoginResponseDto(Long userId, String accessToken, String refreshToken,
public LoginResponseDto(Long userId, String userNickname, String accessToken, String refreshToken,
String tokenType) {
this.userId = userId;
this.userNickname = userNickname;
this.accessToken = accessToken;
this.refreshToken = refreshToken;
this.tokenType = tokenType;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/cvsgo/service/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public LoginResponseDto login(LoginRequestDto request) {

return LoginResponseDto.builder()
.userId(user.getId())
.userNickname(user.getNickname())
.accessToken(accessToken)
.refreshToken(refreshToken.getToken())
.tokenType(TOKEN_TYPE)
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/cvsgo/controller/AuthControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void respond_200_when_login_succeed() throws Exception {
.build();
LoginResponseDto loginResponseDto = LoginResponseDto.builder()
.userId(1L)
.userNickname("닉네임")
.accessToken(getSampleAccessToken())
.refreshToken(getSampleRefreshToken())
.tokenType(TOKEN_TYPE)
Expand All @@ -106,6 +107,7 @@ void respond_200_when_login_succeed() throws Exception {
responseFields(
fieldWithPath("timestamp").type(JsonFieldType.STRING).description("요청 시각"),
fieldWithPath("data.userId").type(JsonFieldType.NUMBER).description("사용자 ID"),
fieldWithPath("data.userNickname").type(JsonFieldType.STRING).description("사용자 닉네임"),
fieldWithPath("data.accessToken").type(JsonFieldType.STRING).description("액세스 토큰"),
fieldWithPath("data.refreshToken").type(JsonFieldType.STRING).description("리프레시 토큰"),
fieldWithPath("data.tokenType").type(JsonFieldType.STRING).description("토큰 종류")
Expand Down

0 comments on commit e039f86

Please sign in to comment.