Skip to content

Commit

Permalink
refactor: 유저의 학적 정보가 없는 경우 예외가 아닌 빈 값을 반환한다. (#68)
Browse files Browse the repository at this point in the history
* refactor: 유저의 학적 정보가 없는 경우 예외가 아닌 빈 값을 반환한다.

* chore: rename Validator to TextValidator
  • Loading branch information
rlarltj authored Feb 7, 2024
1 parent 341bf06 commit 5aa0800
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

import static com.moneymong.utils.Validator.checkText;
import static com.moneymong.utils.TextValidator.checkText;
import static lombok.AccessLevel.PROTECTED;

@Table(name = "user_universities")
@Entity
@Getter
@Builder
@AllArgsConstructor(access = PROTECTED)
@NoArgsConstructor(access = PROTECTED)
@NoArgsConstructor
public class UserUniversity extends TimeBaseEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public UserProfileResponse getUserProfile(Long userId) {
.orElseThrow(() -> new NotFoundException(ErrorCode.USER_NOT_FOUND));

UserUniversity userUniversity = userUniversityRepository.findByUserId(userId)
.orElseThrow(() -> new NotFoundException(ErrorCode.USER_UNIVERSITY_NOT_FOUND));
.orElseGet(() -> UserUniversity.of(userId, null, 0));

return UserProfileResponse.from(user, userUniversity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.util.Assert;

public class Validator {
public class TextValidator {
public static void checkText(String text, String message) {
Assert.hasText(text, message);
}
Expand Down

0 comments on commit 5aa0800

Please sign in to comment.