@justair/justair-library 5.0.0-alpha.fb078ea → 5.0.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measurements.d.ts","sourceRoot":"","sources":["../../src/models/measurements.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"measurements.d.ts","sourceRoot":"","sources":["../../src/models/measurements.js"],"names":[],"mappings":"AA8FA,qCA0BE;AA2IF,+BAAwE;AAxKxE,wBAAmD;AAzBnD,8BAuBE;AAjEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCE;qBA5DmB,UAAU"}
|
package/package.json
CHANGED
|
@@ -83,7 +83,6 @@ const auditSchema = mongoose.Schema(
|
|
|
83
83
|
},
|
|
84
84
|
annotations: [annotationSchema], // Include annotations in audit trail
|
|
85
85
|
isCorrected: { type: Boolean },
|
|
86
|
-
isFog: { type: Boolean },
|
|
87
86
|
},
|
|
88
87
|
{
|
|
89
88
|
timestamps: true,
|
|
@@ -139,7 +138,6 @@ measurementsSchema.index({ "annotations.userId": 1 });
|
|
|
139
138
|
measurementsSchema.pre("findOneAndDelete", async function () {
|
|
140
139
|
const docToDelete = await this.model.findOne(this.getFilter());
|
|
141
140
|
if (docToDelete) {
|
|
142
|
-
console.log("Logging findOneAndDelete to audit", docToDelete);
|
|
143
141
|
const auditLog = new Audit({
|
|
144
142
|
monitorId: docToDelete.monitorId,
|
|
145
143
|
orgId: docToDelete.orgId,
|
|
@@ -190,11 +188,9 @@ measurementsSchema.pre("deleteMany", async function () {
|
|
|
190
188
|
|
|
191
189
|
// Pre-hook to log a single document deletion (for deleteOne)
|
|
192
190
|
measurementsSchema.pre("deleteOne", async function () {
|
|
193
|
-
console.log("deleteOne pre-hook triggered");
|
|
194
191
|
const docToDelete = await this.model.findOne(this.getFilter()).lean();
|
|
195
192
|
|
|
196
193
|
if (docToDelete) {
|
|
197
|
-
console.log("Logging deleteOne to audit", docToDelete);
|
|
198
194
|
const auditLog = new Audit({
|
|
199
195
|
monitorId: docToDelete.monitorId,
|
|
200
196
|
orgId: docToDelete.orgId,
|
|
@@ -218,7 +214,6 @@ measurementsSchema.pre("deleteOne", async function () {
|
|
|
218
214
|
measurementsSchema.pre("findOneAndUpdate", async function () {
|
|
219
215
|
const docToUpdate = await this.model.findOne(this.getFilter()).lean();
|
|
220
216
|
if (docToUpdate) {
|
|
221
|
-
console.log("Logging findOneAndUpdate to audit", docToUpdate);
|
|
222
217
|
const auditLog = new Audit({
|
|
223
218
|
monitorId: docToUpdate.monitorId,
|
|
224
219
|
orgId: docToUpdate.orgId,
|
|
@@ -242,7 +237,6 @@ measurementsSchema.pre("findOneAndUpdate", async function () {
|
|
|
242
237
|
measurementsSchema.pre("updateMany", async function () {
|
|
243
238
|
const docsToUpdate = await this.model.find(this.getFilter()).lean();
|
|
244
239
|
if (docsToUpdate.length) {
|
|
245
|
-
console.log(`Logging ${docsToUpdate.length} documents to audit`);
|
|
246
240
|
const auditLogs = docsToUpdate.map((doc) => ({
|
|
247
241
|
monitorId: doc.monitorId,
|
|
248
242
|
orgId: doc.orgId,
|