Skip to content

Commit bb225bc

Browse files
authored
[HOTFIX] Swagger CORS 관련 오류 조치 (#91)
* 🐛fix: Swagger cors 오류 조치 * 🐛fix: User Entity cnt필드 관련 null 오류 조치 * 🐛fix: 회원가입 시 닉네임 중복검사 로직 추가
1 parent f1cdaa0 commit bb225bc

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

src/main/java/team/wego/wegobackend/auth/application/AuthService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import team.wego.wegobackend.auth.application.dto.response.SignupResponse;
1414
import team.wego.wegobackend.auth.exception.DeletedUserException;
1515
import team.wego.wegobackend.auth.exception.InvalidPasswordException;
16+
import team.wego.wegobackend.auth.exception.NicknameAlreadyExistsException;
1617
import team.wego.wegobackend.auth.exception.UserAlreadyExistsException;
1718
import team.wego.wegobackend.auth.exception.UserNotFoundException;
1819
import team.wego.wegobackend.common.exception.AppErrorCode;
@@ -37,16 +38,18 @@ public class AuthService {
3738

3839
/**
3940
* 회원가입
40-
*
41-
* @return
4241
*/
4342
@Transactional
4443
public SignupResponse signup(SignupRequest request) {
45-
// 이메일 중복 체크
44+
4645
if (userRepository.existsByEmail(request.getEmail())) {
4746
throw new UserAlreadyExistsException();
4847
}
4948

49+
if (userRepository.existsByNickName(request.getNickName())) {
50+
throw new NicknameAlreadyExistsException();
51+
}
52+
5053
User user = User.builder().email(request.getEmail())
5154
.password(passwordEncoder.encode(request.getPassword())).nickName(request.getNickName())
5255
.role(Role.ROLE_USER) //default
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package team.wego.wegobackend.auth.exception;
2+
3+
import team.wego.wegobackend.common.exception.AppErrorCode;
4+
import team.wego.wegobackend.common.exception.AppException;
5+
6+
public class NicknameAlreadyExistsException extends AppException {
7+
8+
public NicknameAlreadyExistsException() {
9+
super(AppErrorCode.ALREADY_EXIST_NICKNAME);
10+
}
11+
}

src/main/java/team/wego/wegobackend/user/domain/User.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ public class User extends BaseTimeEntity {
5151
@Column(name = "profile_message", length = 500)
5252
private String profileMessage;
5353

54-
@Column(name = "followee_count")
55-
private int followeesCnt;
54+
@Column(name = "followee_count", columnDefinition = "int default 0")
55+
private Integer followeesCnt;
5656

57-
@Column(name = "follower_count")
58-
private int followersCnt;
57+
@Column(name = "follower_count", columnDefinition = "int default 0")
58+
private Integer followersCnt;
5959

60-
@Column(name = "group_joined_count")
61-
private int groupJoinedCnt;
60+
@Column(name = "group_joined_count", columnDefinition = "int default 0")
61+
private Integer groupJoinedCnt;
6262

63-
@Column(name = "group_created_count")
64-
private int groupCreatedCnt;
63+
@Column(name = "group_created_count", columnDefinition = "int default 0")
64+
private Integer groupCreatedCnt;
6565

6666
@Column(name = "notification_enabled", nullable = false)
6767
private Boolean notificationEnabled = false;

0 commit comments

Comments
 (0)