@justair/justair-library 5.0.0-alpha.fb078ea → 5.0.1-alpha.d181fb4

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":"AA+FA,qCA0BE;AAgJF,+BAAwE;AA7KxE,wBAAmD;AA1BnD,8BAwBE;AAlEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCE;qBA5DmB,UAAU"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/models/samples.js"],"names":[],"mappings":"AAoCA,gCAkBE;AA6HF,0BAAyD;AAlJzD,+BAAwE;AAvBxE,qCAoBE;AAzBF;;EAEE"}
1
+ {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/models/samples.js"],"names":[],"mappings":"AAqCA,gCAmBE;AAkIF,0BAAyD;AAxJzD,+BAAwE;AAxBxE,qCAqBE;AA1BF;;EAEE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=samples.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"samples.test.d.ts","sourceRoot":"","sources":["../../../src/models/tests/samples.test.js"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justair/justair-library",
3
- "version": "5.0.0-alpha.fb078ea",
3
+ "version": "5.0.1-alpha.d181fb4",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -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,
@@ -12,6 +12,7 @@ const samplesAuditSchema = mongoose.Schema(
12
12
  {
13
13
  siteId: { type: mongoose.Types.ObjectId, ref: "SampleSites" },
14
14
  orgId: { type: mongoose.Types.ObjectId, ref: "Organizations" },
15
+ filterId: { type: String },
15
16
  siteCode: { type: String }, // reference to SampleSites.code
16
17
  periodStartDate: { type: Date },
17
18
  periodEndDate: { type: Date },
@@ -38,6 +39,7 @@ const samplesSchema = mongoose.Schema(
38
39
  {
39
40
  siteId: { type: mongoose.Types.ObjectId, ref: "SampleSites" },
40
41
  orgId: { type: mongoose.Types.ObjectId, ref: "Organizations" },
42
+ filterId: { type: String },
41
43
  siteCode: { type: String }, // reference to SampleSites.code
42
44
  periodStartDate: { type: Date },
43
45
  periodEndDate: { type: Date },
@@ -68,6 +70,7 @@ samplesSchema.pre("findOneAndDelete", async function () {
68
70
  const auditLog = new SamplesAudit({
69
71
  siteId: docToDelete.siteId,
70
72
  orgId: docToDelete.orgId,
73
+ filterId: docToDelete.filterId,
71
74
  siteCode: docToDelete.siteCode,
72
75
  periodStartDate: docToDelete.periodStartDate,
73
76
  periodEndDate: docToDelete.periodEndDate,
@@ -91,6 +94,7 @@ samplesSchema.pre("deleteMany", async function () {
91
94
  const auditLogs = docsToDelete.map((doc) => ({
92
95
  siteId: doc.siteId,
93
96
  orgId: doc.orgId,
97
+ filterId: doc.filterId,
94
98
  siteCode: doc.siteCode,
95
99
  periodStartDate: doc.periodStartDate,
96
100
  periodEndDate: doc.periodEndDate,
@@ -114,6 +118,7 @@ samplesSchema.pre("deleteOne", async function () {
114
118
  const auditLog = new SamplesAudit({
115
119
  siteId: docToDelete.siteId,
116
120
  orgId: docToDelete.orgId,
121
+ filterId: docToDelete.filterId,
117
122
  siteCode: docToDelete.siteCode,
118
123
  periodStartDate: docToDelete.periodStartDate,
119
124
  periodEndDate: docToDelete.periodEndDate,
@@ -137,6 +142,7 @@ samplesSchema.pre("findOneAndUpdate", async function () {
137
142
  const auditLog = new SamplesAudit({
138
143
  siteId: docToUpdate.siteId,
139
144
  orgId: docToUpdate.orgId,
145
+ filterId: docToUpdate.filterId,
140
146
  siteCode: docToUpdate.siteCode,
141
147
  periodStartDate: docToUpdate.periodStartDate,
142
148
  periodEndDate: docToUpdate.periodEndDate,
@@ -160,6 +166,7 @@ samplesSchema.pre("updateMany", async function () {
160
166
  const auditLogs = docsToUpdate.map((doc) => ({
161
167
  siteId: doc.siteId,
162
168
  orgId: doc.orgId,
169
+ filterId: doc.filterId,
163
170
  siteCode: doc.siteCode,
164
171
  periodStartDate: doc.periodStartDate,
165
172
  periodEndDate: doc.periodEndDate,