Skip to content

Commit 346c006

Browse files
committed
Adding fields to drones and service, fixes 3
1 parent 47cbec9 commit 346c006

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/Drone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Mixed = mongoose.Schema.Types.Mixed;
2121
const DroneSchema = new mongoose.Schema({
2222
name: {type: String, required: true},
2323
description: { type: String, required: false },
24-
status: {type: String, enum: _.values(DroneStatus), required: true},
24+
status: {type: String, enum: _.values(DroneStatus), required: false},
2525
// realtime coordinate of the drone
2626
currentLocation: {type: [Number], index: {type: '2dsphere', sparse: true}},
2727
deviceId: { type: String, required: false },

services/DroneService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function *updateLocation(id, entity, returnNFZ, nfzFields, nfzLimit, nearDronesM
265265
}
266266

267267
drone.currentLocation = [entity.lng, entity.lat];
268-
drone.status = entity.status;
268+
drone.status = entity.status || drone.status;
269269
drone.altitude = entity.altitude;
270270
drone.heading = entity.heading;
271271
drone.speed = entity.speed;

0 commit comments

Comments
 (0)