fix: Check if is under restricted

This commit is contained in:
js0ny 2025-11-28 03:54:40 +00:00
parent 72eb53817c
commit e96c0896b9
3 changed files with 12 additions and 2 deletions

View file

@ -31,6 +31,7 @@
newman
gron
fx
google-java-format
];
shellHook = ''
export JAVA_HOME=${pkgs.jdk21}

View file

@ -118,6 +118,15 @@ public class PathFinderService {
return new DeliveryPathResponse(0f, 0, new DronePath[0]);
}
for (var r : records) {
if (isRestricted(r.delivery())) {
throw new IllegalStateException(
"Delivery "
+ r.id()
+ " is located within a restricted area and cannot be fulfilled");
}
}
Map<String, List<MedDispatchRecRequest>> assigned = assignDeliveries(records);
List<DronePath> paths = new ArrayList<>();

View file

@ -264,7 +264,7 @@ public class ApiControllerTest {
@Test
@DisplayName(
"POST /isInRegion -> 400 Bad Request: Passing a list of empty vertices to"
+ " isInRegion")
+ " isInRegion")
void getIsInRegion_shouldReturn400_whenPassingIllegalArguments() throws Exception {
var position = new LngLat(1, 1);
var region = new Region("illegal", List.of());
@ -281,7 +281,7 @@ public class ApiControllerTest {
@Test
@DisplayName(
"POST /isInRegion -> 400 Bad Request: Passing a list of not-closing vertices to"
+ " isInRegion")
+ " isInRegion")
void getIsInRegion_shouldReturn400_whenPassingNotClosingVertices() throws Exception {
var position = new LngLat(1, 1);
var region =