Skip to content

Commit

Permalink
Merge pull request #56 from FlouD-2024/mypage
Browse files Browse the repository at this point in the history
Fix: 닉네임 중복 체크
  • Loading branch information
Kang1221 authored Mar 20, 2024
2 parents 163d00b + 6a547ec commit de2a6d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/floud/demo/domain/Users.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public class Users extends BaseTimeEntity {
private String email;

@Column(length = 500)
@ColumnDefault("''") //디폴트 빈 문자열 설정
@ColumnDefault(" ") //디폴트 빈 문자열 설정
private String introduction;

@Column(length = 500)
@ColumnDefault("''") //디폴트 빈 문자열 설정
@ColumnDefault(" ") //디폴트 빈 문자열 설정
private String memo;

@OneToMany(mappedBy = "users", fetch = FetchType.LAZY)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/floud/demo/service/MemoirService.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public ApiResponse<?> createMemoir(String authorizationHeader, MemoirCreateReque

//Check whether user posts today's memoir
LocalDate now = LocalDate.now();
log.debug(now.toString());
if(memoirRepository.existsByUserAndCreatedAtBetween(users.getId(), now))
return ApiResponse.failure(Error.MEMOIR_ALREADY_EXIST);

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/floud/demo/service/MyPageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public ApiResponse<?> getMyPage(String authorizationHeader){

@Transactional
public ApiResponse<?> checkDuplicatedName(String authorizationHeader, String nickname){
if(authService.findUserByToken(authorizationHeader).getNickname().equals(nickname))
return ApiResponse.success(Success.CHECK_NICKNAME_DUPLICATED, Map.of("isDuplicated", false));
return ApiResponse.success(Success.CHECK_NICKNAME_DUPLICATED, Map.of("isDuplicated", checkNicknameDuplicated(nickname)));
}

Expand Down

0 comments on commit de2a6d2

Please sign in to comment.