Skip to content

Commit

Permalink
Issue jmprathab#257 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DDmit04 committed Mar 9, 2021
1 parent ff3a523 commit 2173dcd
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
import com.myhome.domain.Amenity;
import com.myhome.domain.Community;
import com.myhome.model.AmenityDto;
import com.myhome.repositories.AmenityBookingItemRepository;
import com.myhome.repositories.AmenityRepository;
import com.myhome.repositories.CommunityRepository;
import com.myhome.services.AmenityBookingService;
import com.myhome.services.AmenityService;
import com.myhome.services.CommunityService;
import java.util.HashSet;

import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import com.myhome.services.HouseService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand All @@ -41,7 +42,8 @@ public class AmenitySDJpaService implements AmenityService {
private final CommunityRepository communityRepository;
private final CommunityService communityService;
private final AmenityApiMapper amenityApiMapper;
private final AmenityBookingItemRepository bookingRepository;
private final AmenityBookingService amenityBookingService;
private final HouseService houseService;

@Override
public Optional<List<AmenityDto>> createAmenities(Set<AmenityDto> amenities, String communityId) {
Expand Down Expand Up @@ -94,8 +96,7 @@ public Set<Amenity> listAllAmenities(String communityId) {
public boolean updateAmenity(AmenityDto updatedAmenity) {
String amenityId = updatedAmenity.getAmenityId();
return amenityRepository.findByAmenityId(amenityId)
.map(amenity -> communityRepository.findByCommunityId(updatedAmenity.getCommunityId())
.map(community -> {
.map(amenity -> {
Amenity updated = new Amenity();
updated.setName(updatedAmenity.getName());
updated.setPrice(updatedAmenity.getPrice());
Expand All @@ -104,7 +105,6 @@ public boolean updateAmenity(AmenityDto updatedAmenity) {
updated.setDescription(updatedAmenity.getDescription());
return updated;
})
.orElse(null))
.map(amenityRepository::save).isPresent();
}

Expand Down

0 comments on commit 2173dcd

Please sign in to comment.