@justair/justair-library 5.0.0 → 5.1.0-alpha.697ec57
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":"samples.d.ts","sourceRoot":"","sources":["../../src/models/samples.js"],"names":[],"mappings":"
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"samples.test.d.ts","sourceRoot":"","sources":["../../../src/models/tests/samples.test.js"],"names":[],"mappings":""}
|
package/package.json
CHANGED
package/src/models/samples.js
CHANGED
|
@@ -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,
|