File tree Expand file tree Collapse file tree 3 files changed +25
-11
lines changed
src/main/java/team/wego/wegobackend Expand file tree Collapse file tree 3 files changed +25
-11
lines changed Original file line number Diff line number Diff line change 1313import team .wego .wegobackend .auth .application .dto .response .SignupResponse ;
1414import team .wego .wegobackend .auth .exception .DeletedUserException ;
1515import team .wego .wegobackend .auth .exception .InvalidPasswordException ;
16+ import team .wego .wegobackend .auth .exception .NicknameAlreadyExistsException ;
1617import team .wego .wegobackend .auth .exception .UserAlreadyExistsException ;
1718import team .wego .wegobackend .auth .exception .UserNotFoundException ;
1819import 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
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments