Skip to content

Commit

Permalink
Merge pull request #108 from Hoang-Nguyen-Huy/PBS-82-Manage-Amenities
Browse files Browse the repository at this point in the history
ref: refactor delete amenity
  • Loading branch information
nguyenhcp2004 authored Oct 26, 2024
2 parents 6dda2c9 + ebc925b commit 131cb1d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public AmenityResponse updateAmenity(int amenityId, AmenityCreationRequest reque
public String deleteAmenity(int amenityId){
Amenity existingAmenity = amenityRepository.findById(amenityId)
.orElseThrow(() -> new EntityNotFoundException("Amenity not found"));
existingAmenity.setIsDeleted(1);
existingAmenity.setIsDeleted(existingAmenity.getIsDeleted() == 1 ? 0 : 1);
amenityRepository.save(existingAmenity);
return "Delete amenity " + amenityId + " successfully";
}
Expand Down

0 comments on commit 131cb1d

Please sign in to comment.