fixed location changes
This commit is contained in:
@@ -10,4 +10,8 @@ import java.util.Optional;
|
||||
public interface LocationRepository extends JpaRepository<LocationEntity, Long> {
|
||||
|
||||
Optional<LocationEntity> findLocationByLocation(String name);
|
||||
|
||||
Boolean existsByLocation(String name);
|
||||
|
||||
void deleteByLocation(String name);
|
||||
}
|
||||
|
||||
@@ -49,11 +49,11 @@ public class LocationService {
|
||||
}
|
||||
|
||||
public boolean deleteLocation(String name) {
|
||||
boolean exists = locationRepository.existsById(id);
|
||||
boolean exists = locationRepository.existsByLocation(name);
|
||||
if(!exists){
|
||||
return false;
|
||||
}
|
||||
locationRepository.deleteByName(name);
|
||||
locationRepository.deleteByLocation(name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user