@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justair/justair-library",
3
- "version": "3.3.4-papa",
3
+ "version": "3.3.4-sierra",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -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 });