@justair/justair-library 4.8.16 → 4.8.17

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": "4.8.16",
3
+ "version": "4.8.17",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -82,6 +82,7 @@ const auditSchema = mongoose.Schema(
82
82
  default: {},
83
83
  },
84
84
  annotations: [annotationSchema], // Include annotations in audit trail
85
+ isCorrected: { type: Boolean, default: false },
85
86
  },
86
87
  {
87
88
  timestamps: true,
@@ -111,6 +112,7 @@ const measurementsSchema = mongoose.Schema(
111
112
  type: [annotationSchema],
112
113
  default: [],
113
114
  },
115
+ isCorrected: { type: Boolean, default: false },
114
116
  },
115
117
  {
116
118
  timestamps: true,
@@ -148,6 +150,7 @@ measurementsSchema.pre("findOneAndDelete", async function () {
148
150
  flags: docToDelete.flags,
149
151
  appliedCorrections: docToDelete.appliedCorrections,
150
152
  annotations: docToDelete.annotations, // Include annotations in audit
153
+ isCorrected: docToDelete.isCorrected,
151
154
  deletedAt: new Date(),
152
155
  });
153
156
  await auditLog.save();
@@ -173,6 +176,7 @@ measurementsSchema.pre("deleteMany", async function () {
173
176
  flags: doc.flags,
174
177
  appliedCorrections: doc.appliedCorrections,
175
178
  annotations: doc.annotations, // Include annotations in audit
179
+ isCorrected: doc.isCorrected,
176
180
  deletedAt: new Date(),
177
181
  }));
178
182
 
@@ -199,6 +203,7 @@ measurementsSchema.pre("deleteOne", async function () {
199
203
  flags: docToDelete.flags,
200
204
  appliedCorrections: docToDelete.appliedCorrections,
201
205
  annotations: docToDelete.annotations, // Include annotations in audit
206
+ isCorrected: docToDelete.isCorrected,
202
207
  deletedAt: new Date(),
203
208
  });
204
209
  await auditLog.save();
@@ -222,6 +227,7 @@ measurementsSchema.pre("findOneAndUpdate", async function () {
222
227
  flags: docToUpdate.flags,
223
228
  appliedCorrections: docToUpdate.appliedCorrections,
224
229
  annotations: docToUpdate.annotations, // Include annotations in audit
230
+ isCorrected: docToUpdate.isCorrected,
225
231
  deletedAt: null, // No deletion happening, so set it to null or undefined
226
232
  });
227
233
  await auditLog.save();
@@ -245,6 +251,7 @@ measurementsSchema.pre("updateMany", async function () {
245
251
  flags: doc.flags,
246
252
  appliedCorrections: doc.appliedCorrections,
247
253
  annotations: doc.annotations, // Include annotations in audit
254
+ isCorrected: doc.isCorrected,
248
255
  deletedAt: null, // No deletion happening
249
256
  }));
250
257
 
@@ -248,8 +248,6 @@ const monitorsSchema = mongoose.Schema(
248
248
  default: [],
249
249
  },
250
250
  applyCorrections: { type: Boolean, default: false },
251
- // Optional readKey for private API access (e.g. PurpleAir)
252
- readKey: { type: String, required: false },
253
251
  pausedParameters: {
254
252
  type: [{ parameter: String, timestamp: Date, isPaused: Boolean }],
255
253
  default: [],