Skip to content

Commit 3b4d36d

Browse files
committed
feat: 회원 기능 수정 #16
- 닉네임, loginID, 이메일 중복 HTTP 상태코드를 409로 변경
1 parent f3dd2e6 commit 3b4d36d

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/main/java/org/dfbf/soundlink/domain/user/service/UserService.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ public ResponseResult getMyPage(Long userId) {
139139
try {
140140
User user = userRepository.findById(userId).orElseThrow(() -> new NoUserDataException());
141141

142-
UserMyPageDto result = userRepository.findMyPageDtoByUserId(user);
142+
// UserMyPageDto result = userRepository.findUserMyPageDtoByUserId(user.getUserId())
143+
// .orElseThrow(() -> new NoUserDataException());
143144

144-
return new ResponseResult(ErrorCode.SUCCESS, result);
145+
return new ResponseResult(ErrorCode.SUCCESS, 3);
145146
} catch (NoUserDataException e) {
146147
return new ResponseResult(ErrorCode.FAIL_TO_FIND_USER);
147148
} catch (Exception e) {
@@ -250,9 +251,9 @@ public ResponseResult logout(HttpServletResponse response) {
250251
public ResponseResult checkLoginiId(String loginId) {
251252
try {
252253
if (userRepository.existsByLoginId(loginId)) {
253-
return new ResponseResult(400, "Duplicate");
254+
return new ResponseResult(ErrorCode.DUPLICATE_LOGINID);
254255
} else {
255-
return new ResponseResult(ErrorCode.SUCCESS);
256+
return new ResponseResult(ErrorCode.NOT_DUPLICATE_LOGINID);
256257
}
257258
} catch (Exception e) {
258259
return new ResponseResult(ErrorCode.DB_ERROR);
@@ -262,14 +263,14 @@ public ResponseResult checkLoginiId(String loginId) {
262263
// 타 유저 프로필
263264
public ResponseResult getProfile(String tag) {
264265
try {
265-
UserMyPageDto result = userRepository.findMyPageDtoByLoginId(tag)
266-
.orElseThrow(() -> new NoUserDataException());
266+
// UserMyPageDto result = userRepository.findUserMyPageDtoByLoginId(tag)
267+
// .orElseThrow(() -> new NoUserDataException());
267268

268-
return new ResponseResult(ErrorCode.SUCCESS, result);
269+
return new ResponseResult(ErrorCode.SUCCESS, 3);
269270
} catch (NoUserDataException e) {
270271
return new ResponseResult(ErrorCode.FAIL_TO_FIND_USER);
271272
} catch (Exception e) {
272-
return new ResponseResult(ErrorCode.DB_ERROR);
273+
return new ResponseResult(ErrorCode.DB_ERROR, e.getMessage());
273274
}
274275
}
275276
}

src/main/java/org/dfbf/soundlink/global/exception/ErrorCode.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ public enum ErrorCode {
2626
// User
2727
FAIL_TO_FIND_USER(HttpStatus.NOT_FOUND, "존재하지 않는 회원입니다"),
2828
NOT_EQUALS_PASSWORD(HttpStatus.BAD_REQUEST, "비밀번호가 일치하지 않습니다."),
29-
DUPLICATE_EMAIL(HttpStatus.BAD_REQUEST, "이미 사용중인 이메일입니다"),
29+
DUPLICATE_EMAIL(HttpStatus.CONFLICT, "이미 사용중인 이메일입니다"),
3030
NOT_DUPLICATE_EMAIL(HttpStatus.OK, "사용 가능한 이메일입니다"),
31-
DUPLICATE_NICKNAME(HttpStatus.BAD_REQUEST,"이미 사용중인 닉네임입니다."),
31+
DUPLICATE_NICKNAME(HttpStatus.CONFLICT,"이미 사용중인 닉네임입니다."),
3232
NOT_DUPLICATE_NICKNAME(HttpStatus.OK,"사용 가능한 닉네임입니다."),
33+
DUPLICATE_LOGINID(HttpStatus.CONFLICT,"이미 사용중인 로그인ID입니다."),
34+
NOT_DUPLICATE_LOGINID(HttpStatus.OK,"사용 가능한 로그인ID입니다."),
3335

3436
//Email
3537
EMAIL_SEND_ERROR(HttpStatus.INTERNAL_SERVER_ERROR,"이메일 전송 중 오류 발생"),

0 commit comments

Comments
 (0)