Skip to content

Commit

Permalink
[#38] feat: Guest, Budget validation 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hsik0225 committed Jun 5, 2020
1 parent 7be30ad commit d6a81dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions BE/src/main/java/com/codesquad/airbnb/room/domain/Budget.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

import lombok.*;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.Min;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Budget {

@Min(0)
private int lowestPrice;

private int highestPrice = Integer.MAX_VALUE;

@AssertTrue
private boolean validateBudget() {
return highestPrice > lowestPrice;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class MainController {

@GetMapping("")
public Main showMain(ReservationDate reservationDate,
Guest guest,
Budget budget) {
@Valid Guest guest,
@Valid Budget budget) {

reservationDate.validateReservationDate();
return viewDAO.main(utilDAO, reservationDate, guest, budget);
Expand Down

0 comments on commit d6a81dc

Please sign in to comment.