Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lofri97 committed Jun 3, 2022
2 parents bd9fedd + b883c1d commit d1ef1db
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/hansung/ac/kr/fooding/domain/Restaurant.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class Restaurant extends BaseEntity{
@JoinColumn(name = "restaurant_id")
private List<Review> reviews = new ArrayList<>();

private int viewCount;
private int viewCount = 0;

public void setViewCount(int viewCount) {
this.viewCount = viewCount;
Expand Down Expand Up @@ -136,6 +136,6 @@ public Restaurant(RestaurantPostDTO dto, Admin admin){
}

public void plusViewCount() {
this.setViewCount(this.getViewCount() + 1);
this.setViewCount(getViewCount() + 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class JwtTokenProvider implements InitializingBean {
private final String AUTHORITIES_KEY = "auth";
private final String secret;
private final long tokenValidityInseconds;
private long tokenValidityInseconds;
private Key key;

public JwtTokenProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void deleteReservation(Long reserveId) throws IllegalStateException, Secu
if (optionalReservation.isEmpty()) throw new IllegalStateException("Fooding-Reservation Not Found");
Reservation reservation = optionalReservation.get();

if (reservation.getBooker().getMember_id() != member.getId()) throw new SecurityException("Fooding-Not Reservation Owner");
if (!Objects.equals(reservation.getBooker().getMember_id(), member.getId())) throw new SecurityException("Fooding-Not Reservation Owner");

reservation.getRestaurant().getReservations().remove(reservation);
reservationRepository.delete(reservation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public Long saveWithImage(RestaurantPostDTO postDTO, List<MultipartFile> multipa
return restaurant.getId();
}

@Transactional
public RestInfoGetDTO getRestaurantInfo(Long id, Account account) throws IllegalStateException {
Optional<Restaurant> optional = restaurantRepository.findById(id);
Restaurant restaurant = optional.orElseThrow(() -> new IllegalStateException(CError.REST_NOT_FOUND.getMessage()));
Expand Down

0 comments on commit d1ef1db

Please sign in to comment.