Skip to content

Commit

Permalink
REFACTOR: 게시글 작성 request dto 유효성 검증 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
givesilverstick committed Aug 17, 2023
1 parent 1938c98 commit 9d233cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ public ResponseEntity<NormalResponseDto> postDelivery(@CurrentUser Member member
List<Building> buildings = deliveryService.getBuildingsBySchool(member.getSchool());

// 사용자가 선택한 건물이 올바른지 확인

if (!buildings.containsAll(selectedBuilding)) {
throw new WonderException(ErrorCode.BUILDING_NOT_MATCH);
}

if (requestDto.getPostReqType() == null) {
throw new WonderException(ErrorCode.VALUE_IS_NONNULL);
} else if (requestDto.getSanitaryNum() == null) {
throw new WonderException(ErrorCode.VALUE_IS_NONNULL);
} else if (requestDto.getSanitarySize() == null) {
throw new WonderException(ErrorCode.VALUE_IS_NONNULL);
} else if (requestDto.getSanitaryType() == null) {
throw new WonderException(ErrorCode.VALUE_IS_NONNULL);
}

deliveryService.postDelivery(member, requestDto);
return ResponseEntity.ok(NormalResponseDto.success());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DeliveryRequestDto {

private ReqType postReqType;

private int sanitaryNum;
private Integer sanitaryNum;

private SanitarySize sanitarySize;

Expand Down

0 comments on commit 9d233cf

Please sign in to comment.