Skip to content

Commit

Permalink
Merge pull request #51 from Catch-You/fix/사건상세조회
Browse files Browse the repository at this point in the history
[REFACTOR] 로그인 시 회원 이름도 조회되도록 수정
  • Loading branch information
xloyeon authored Dec 16, 2023
2 parents 1914c10 + 2bea781 commit e2c0f6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.catchyou.api.auth.controller;

import com.catchyou.domain.user.entity.User;
import com.catchyou.domain.user.enums.Role;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -18,17 +19,20 @@ public class AuthResponse {

private Long accessTokenExpireDate;

private String userName;

private Role role;

public static AuthResponse of(
String accessToken, String refreshToken, Long userId, Long accessTokenExpireDate, Role role
String accessToken, String refreshToken, User user, Long accessTokenExpireDate
){
return AuthResponse.builder()
.accessToken(accessToken)
.refreshToken(refreshToken)
.userId(userId)
.userId(user.getId())
.accessTokenExpireDate(accessTokenExpireDate)
.role(role)
.userName(user.getName())
.role(user.getRole())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ private AuthResponse createAuthResponse(User user){
return AuthResponse.of(
resolveAccessToken(user.getId(), user.getRole().getAuthority()),
resolveRefreshToken(user.getId()),
user.getId(),
jwtProvider.getAccessTokenTTlSecond(),
user.getRole()
user,
jwtProvider.getAccessTokenTTlSecond()
);
}
}

0 comments on commit e2c0f6d

Please sign in to comment.