@justair/justair-library 3.3.4-papa → 3.3.4-sierra
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/models/monitors.js +12 -11
package/package.json
CHANGED
package/src/models/monitors.js
CHANGED
|
@@ -81,23 +81,24 @@ const monitorsSchema = mongoose.Schema(
|
|
|
81
81
|
calculatedAverages: [Object],
|
|
82
82
|
images: [String],
|
|
83
83
|
isActive: { type: Boolean, default: true },
|
|
84
|
-
parameterThresholds: {
|
|
85
|
-
type: mongoose.Schema.Types.Mixed,
|
|
86
|
-
validate: {
|
|
87
|
-
validator: function(v) {
|
|
88
|
-
return Object.keys(v).every(key => parametersEnum.includes(key)
|
|
89
|
-
|
|
90
|
-
);
|
|
91
|
-
},
|
|
92
|
-
message: props => `${props.value} is not a valid parameter threshold object`
|
|
93
|
-
}
|
|
94
|
-
} ,
|
|
84
|
+
parameterThresholds: { type: mongoose.Schema.Types.Mixed, }
|
|
95
85
|
},
|
|
96
86
|
{
|
|
97
87
|
timestamps: true,
|
|
98
88
|
}
|
|
99
89
|
);
|
|
100
90
|
|
|
91
|
+
monitorsSchema.path('parameterThresholds').validate({
|
|
92
|
+
validator: function(v) {
|
|
93
|
+
return Object.keys(v).every(key => {
|
|
94
|
+
console.log(v)
|
|
95
|
+
console.log(key)
|
|
96
|
+
return parametersEnum.includes(key)
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
message: props => `${props.value} is not a valid parameter threshold object`
|
|
100
|
+
})
|
|
101
|
+
|
|
101
102
|
monitorsSchema.index({ gpsLocation: "2dsphere" });
|
|
102
103
|
monitorsSchema.index({ monitorSupplier: 1 });
|
|
103
104
|
monitorsSchema.index({ monitorIdFromSupplier: 1 });
|