@dynamatix/gb-schemas 2.3.333 → 2.3.336
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/dist/applications/application-product.model.d.ts +78 -0
- package/dist/applications/application-product.model.d.ts.map +1 -1
- package/dist/applications/application-product.model.js +7 -1
- package/dist/shared/workflow.plugin.d.ts.map +1 -1
- package/dist/shared/workflow.plugin.js +22 -3
- package/package.json +1 -1
|
@@ -34,6 +34,19 @@ declare const ProductModel: mongoose.Model<{
|
|
|
34
34
|
selectedProduct: string;
|
|
35
35
|
networkClubSubmission: boolean;
|
|
36
36
|
introducerSubmission: boolean;
|
|
37
|
+
reasons: mongoose.Types.DocumentArray<{
|
|
38
|
+
Description: string;
|
|
39
|
+
IsOverridden: boolean;
|
|
40
|
+
RuleType: string;
|
|
41
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
42
|
+
Description: string;
|
|
43
|
+
IsOverridden: boolean;
|
|
44
|
+
RuleType: string;
|
|
45
|
+
}> & {
|
|
46
|
+
Description: string;
|
|
47
|
+
IsOverridden: boolean;
|
|
48
|
+
RuleType: string;
|
|
49
|
+
}>;
|
|
37
50
|
applicationId?: unknown;
|
|
38
51
|
pageValidFlag?: unknown;
|
|
39
52
|
topSlicing?: unknown;
|
|
@@ -61,6 +74,19 @@ declare const ProductModel: mongoose.Model<{
|
|
|
61
74
|
selectedProduct: string;
|
|
62
75
|
networkClubSubmission: boolean;
|
|
63
76
|
introducerSubmission: boolean;
|
|
77
|
+
reasons: mongoose.Types.DocumentArray<{
|
|
78
|
+
Description: string;
|
|
79
|
+
IsOverridden: boolean;
|
|
80
|
+
RuleType: string;
|
|
81
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
82
|
+
Description: string;
|
|
83
|
+
IsOverridden: boolean;
|
|
84
|
+
RuleType: string;
|
|
85
|
+
}> & {
|
|
86
|
+
Description: string;
|
|
87
|
+
IsOverridden: boolean;
|
|
88
|
+
RuleType: string;
|
|
89
|
+
}>;
|
|
64
90
|
applicationId?: unknown;
|
|
65
91
|
pageValidFlag?: unknown;
|
|
66
92
|
topSlicing?: unknown;
|
|
@@ -88,6 +114,19 @@ declare const ProductModel: mongoose.Model<{
|
|
|
88
114
|
selectedProduct: string;
|
|
89
115
|
networkClubSubmission: boolean;
|
|
90
116
|
introducerSubmission: boolean;
|
|
117
|
+
reasons: mongoose.Types.DocumentArray<{
|
|
118
|
+
Description: string;
|
|
119
|
+
IsOverridden: boolean;
|
|
120
|
+
RuleType: string;
|
|
121
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
122
|
+
Description: string;
|
|
123
|
+
IsOverridden: boolean;
|
|
124
|
+
RuleType: string;
|
|
125
|
+
}> & {
|
|
126
|
+
Description: string;
|
|
127
|
+
IsOverridden: boolean;
|
|
128
|
+
RuleType: string;
|
|
129
|
+
}>;
|
|
91
130
|
applicationId?: unknown;
|
|
92
131
|
pageValidFlag?: unknown;
|
|
93
132
|
topSlicing?: unknown;
|
|
@@ -129,6 +168,19 @@ declare const ProductModel: mongoose.Model<{
|
|
|
129
168
|
selectedProduct: string;
|
|
130
169
|
networkClubSubmission: boolean;
|
|
131
170
|
introducerSubmission: boolean;
|
|
171
|
+
reasons: mongoose.Types.DocumentArray<{
|
|
172
|
+
Description: string;
|
|
173
|
+
IsOverridden: boolean;
|
|
174
|
+
RuleType: string;
|
|
175
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
176
|
+
Description: string;
|
|
177
|
+
IsOverridden: boolean;
|
|
178
|
+
RuleType: string;
|
|
179
|
+
}> & {
|
|
180
|
+
Description: string;
|
|
181
|
+
IsOverridden: boolean;
|
|
182
|
+
RuleType: string;
|
|
183
|
+
}>;
|
|
132
184
|
applicationId?: unknown;
|
|
133
185
|
pageValidFlag?: unknown;
|
|
134
186
|
topSlicing?: unknown;
|
|
@@ -156,6 +208,19 @@ declare const ProductModel: mongoose.Model<{
|
|
|
156
208
|
selectedProduct: string;
|
|
157
209
|
networkClubSubmission: boolean;
|
|
158
210
|
introducerSubmission: boolean;
|
|
211
|
+
reasons: mongoose.Types.DocumentArray<{
|
|
212
|
+
Description: string;
|
|
213
|
+
IsOverridden: boolean;
|
|
214
|
+
RuleType: string;
|
|
215
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
216
|
+
Description: string;
|
|
217
|
+
IsOverridden: boolean;
|
|
218
|
+
RuleType: string;
|
|
219
|
+
}> & {
|
|
220
|
+
Description: string;
|
|
221
|
+
IsOverridden: boolean;
|
|
222
|
+
RuleType: string;
|
|
223
|
+
}>;
|
|
159
224
|
applicationId?: unknown;
|
|
160
225
|
pageValidFlag?: unknown;
|
|
161
226
|
topSlicing?: unknown;
|
|
@@ -183,6 +248,19 @@ declare const ProductModel: mongoose.Model<{
|
|
|
183
248
|
selectedProduct: string;
|
|
184
249
|
networkClubSubmission: boolean;
|
|
185
250
|
introducerSubmission: boolean;
|
|
251
|
+
reasons: mongoose.Types.DocumentArray<{
|
|
252
|
+
Description: string;
|
|
253
|
+
IsOverridden: boolean;
|
|
254
|
+
RuleType: string;
|
|
255
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
256
|
+
Description: string;
|
|
257
|
+
IsOverridden: boolean;
|
|
258
|
+
RuleType: string;
|
|
259
|
+
}> & {
|
|
260
|
+
Description: string;
|
|
261
|
+
IsOverridden: boolean;
|
|
262
|
+
RuleType: string;
|
|
263
|
+
}>;
|
|
186
264
|
applicationId?: unknown;
|
|
187
265
|
pageValidFlag?: unknown;
|
|
188
266
|
topSlicing?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-product.model.d.ts","sourceRoot":"","sources":["../../applications/application-product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"application-product.model.d.ts","sourceRoot":"","sources":["../../applications/application-product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAoGhC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2C,CAAC;AAC9D,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
2
|
import { applyWorkflowPlugin } from "../shared/workflow.plugin";
|
|
3
3
|
import { Pound, formatPound } from "../value-objects/pound";
|
|
4
|
+
const reasonSchema = new mongoose.Schema({
|
|
5
|
+
Description: { type: String, required: true },
|
|
6
|
+
IsOverridden: { type: Boolean, required: true },
|
|
7
|
+
RuleType: { type: String, required: true }
|
|
8
|
+
});
|
|
4
9
|
const productSchema = new mongoose.Schema({
|
|
5
10
|
applicationId: {
|
|
6
11
|
type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true,
|
|
@@ -27,7 +32,8 @@ const productSchema = new mongoose.Schema({
|
|
|
27
32
|
tempAppFee: { type: Pound, default: 0.00, required: true, get: formatPound },
|
|
28
33
|
productFeePaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
|
|
29
34
|
overriddenRulesApproverLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
|
|
30
|
-
overrideRuleComments: { type: String, default: '' }
|
|
35
|
+
overrideRuleComments: { type: String, default: '' },
|
|
36
|
+
reasons: [reasonSchema]
|
|
31
37
|
}, {
|
|
32
38
|
timestamps: true,
|
|
33
39
|
toJSON: { virtuals: true, getters: true },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.plugin.d.ts","sourceRoot":"","sources":["../../shared/workflow.plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"workflow.plugin.d.ts","sourceRoot":"","sources":["../../shared/workflow.plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,QAyGnE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,SAGrC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,QAE9E"}
|
|
@@ -51,15 +51,34 @@ export function workflowPlugin(schema, options) {
|
|
|
51
51
|
next();
|
|
52
52
|
});
|
|
53
53
|
// Apply post-remove middleware
|
|
54
|
-
schema.post(/^delete/, async function (
|
|
55
|
-
|
|
54
|
+
schema.post(/^delete/, async function (result, next) {
|
|
55
|
+
// Try multiple methods to get model name since context differs in delete hooks
|
|
56
|
+
// For query hooks (model.deleteOne or doc.deleteOne), 'this' is the query
|
|
57
|
+
let recordType = 'unknown';
|
|
58
|
+
// Try from query context first (most reliable for deleteOne hooks)
|
|
59
|
+
// When doc.deleteOne() is called, 'this' refers to the query object
|
|
60
|
+
if (this?.model?.modelName) {
|
|
61
|
+
recordType = this.model.modelName.toLowerCase();
|
|
62
|
+
}
|
|
63
|
+
// Try from schema modelName
|
|
64
|
+
else if (schema?.modelName) {
|
|
65
|
+
recordType = schema.modelName.toLowerCase();
|
|
66
|
+
}
|
|
67
|
+
// Try from collection name as fallback
|
|
68
|
+
else if (this?.model?.collection?.name) {
|
|
69
|
+
recordType = this.model.collection.name.toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
// Try from result if it's a document
|
|
72
|
+
else if (result?.constructor?.modelName) {
|
|
73
|
+
recordType = result.constructor.modelName.toLowerCase();
|
|
74
|
+
}
|
|
56
75
|
console.log(`🗑️ Post-delete middleware triggered for ${recordType}`);
|
|
57
76
|
try {
|
|
58
77
|
await middleware.handleEvent({
|
|
59
78
|
recordType,
|
|
60
79
|
action: 'deleted',
|
|
61
80
|
triggerKey: `${recordType}.deleted`
|
|
62
|
-
},
|
|
81
|
+
}, result);
|
|
63
82
|
}
|
|
64
83
|
catch (error) {
|
|
65
84
|
console.error('Workflow middleware error:', error);
|