Skip to content

Commit 4b24122

Browse files
committed
Adding fields to drones and service, fixes 4
1 parent 346c006 commit 4b24122

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

services/DroneService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ function *getSingle(id) {
229229
updateLocation.schema = {
230230
id: joi.string().required(),
231231
entity: joi.object().keys({
232-
lat: joi.number().required(),
233-
lng: joi.number().required(),
232+
lat: joi.number(), // Made these not required, we need to turn this into a general drone update endpoint / service (so we can update just status, speed, ...etc)
233+
lng: joi.number(),
234234
status: joi.string(),
235235
altitude: joi.number(),
236236
heading: joi.number(),
@@ -264,7 +264,7 @@ function *updateLocation(id, entity, returnNFZ, nfzFields, nfzLimit, nearDronesM
264264
throw new errors.NotFoundError(`Current logged in provider does not have this drone , id = ${id}`);
265265
}
266266

267-
drone.currentLocation = [entity.lng, entity.lat];
267+
drone.currentLocation = [entity.lng || drone.currentLocation[0], entity.lat || drone.currentLocation[1]];
268268
drone.status = entity.status || drone.status;
269269
drone.altitude = entity.altitude;
270270
drone.heading = entity.heading;

0 commit comments

Comments
 (0)