Merge pull request #120 from TeamBNBN/BE/user
feat: user login, qna 조회 수정
This commit is contained in:
commit
c99d3cc7ec
@ -14,6 +14,7 @@ import java.util.Date;
|
||||
public class QnaResponseDto {
|
||||
|
||||
|
||||
private Long id;
|
||||
private String title;
|
||||
private String username;
|
||||
private String content;
|
||||
@ -22,7 +23,7 @@ public class QnaResponseDto {
|
||||
public static QnaResponseDto toEntity(Qna qna)
|
||||
{
|
||||
return new QnaResponseDto(
|
||||
|
||||
qna.getId(),
|
||||
qna.getTitle(),
|
||||
qna.getUser().getName(),
|
||||
qna.getContent(),
|
||||
|
@ -50,11 +50,14 @@ public class UserController {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
HttpStatus status = HttpStatus.ACCEPTED;
|
||||
|
||||
String name= user.getName();
|
||||
resultMap.put("name",name);
|
||||
|
||||
|
||||
try {
|
||||
User loginUser = userService.login(user);
|
||||
if (loginUser != null) {
|
||||
|
||||
String name = loginUser.getName();
|
||||
resultMap.put("name",name);
|
||||
String accessToken = jwtUtil.createAccessToken(String.valueOf(loginUser.getId()));
|
||||
String refreshToken = jwtUtil.createRefreshToken(String.valueOf(loginUser.getId()));
|
||||
|
||||
|
@ -11,5 +11,5 @@ public interface UserService {
|
||||
User userInfo(Long id) throws Exception;
|
||||
void sendEamail(User user) throws Exception;
|
||||
void userCheck(Long id) throws Exception;
|
||||
|
||||
String getUserName(Long id) throws Exception;
|
||||
}
|
||||
|
@ -136,6 +136,13 @@ public class UserServiceImpl implements UserService{
|
||||
sendEamail(user);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserName(Long id) throws Exception {
|
||||
|
||||
return userRepository.findById(id).get().getName();
|
||||
}
|
||||
|
||||
public String getTempPassword() {
|
||||
char[] charSet = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
|
||||
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
|
||||
|
Loading…
Reference in New Issue
Block a user