Skip to content

Commit

Permalink
[feature] #130 평점 1~5 범위 확인
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeesw committed May 4, 2024
1 parent 25b63c4 commit cb4f892
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ public Boolean isMatching(MatchIdDto dto) {

@Transactional
public Review saveReview(ReviewDto dto) {
if (dto.getRating() < 1 || dto.getRating() > 5) {
throw new CustomException(ErrorCode.VALUE_ERROR);
}

User sender = userRepository.findByUserId(dto.getSenderId()).orElseThrow();
User receiver = userRepository.findByUserId(dto.getReceiverId()).orElseThrow();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public enum ErrorCode {
REQUEST_NOT_FOUND(HttpStatus.NOT_FOUND, "7404", "해당 요청 정보를 찾을 수 없습니다."),
REQUEST_EXPIRED(HttpStatus.UNAUTHORIZED, "7401", "요청이 만료되었습니다."),

COMPANY_NOT_FOUND(HttpStatus.NOT_FOUND, "8404", "해당 COMPANY를 찾을 수 없습니다.");
COMPANY_NOT_FOUND(HttpStatus.NOT_FOUND, "8404", "해당 COMPANY를 찾을 수 없습니다."),

VALUE_ERROR(HttpStatus.BAD_REQUEST, "9400", "잘못된 값이 입력되었습니다.");

private final HttpStatus status;
private final String code;
Expand Down

0 comments on commit cb4f892

Please sign in to comment.