@dynamatix/cat-shared 0.0.101 → 0.0.103
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/README.md +6 -6
- package/index.js +2 -2
- package/middlewares/audit.middleware.js +340 -340
- package/middlewares/index.js +2 -2
- package/models/audit-config.model.js +15 -15
- package/models/audit.model.js +16 -16
- package/models/form-configuration.model.js +269 -269
- package/models/index.js +3 -3
- package/models/value-reference-map.model.js +16 -16
- package/package.json +21 -21
- package/seeders/value-reference-map.seeder.js +66 -66
- package/services/audit-log.hook.js +2 -2
- package/services/index.js +1 -1
- package/services/request-context.service.js +8 -8
package/middlewares/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {default as applyAuditMiddleware} from './audit.middleware.js';
|
|
2
|
-
export { registerAuditHook } from './audit.middleware.js';
|
|
1
|
+
export {default as applyAuditMiddleware} from './audit.middleware.js';
|
|
2
|
+
export { registerAuditHook } from './audit.middleware.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
const auditConfigSchema = new mongoose.Schema({
|
|
4
|
-
collectionName: String,
|
|
5
|
-
fields: [String],
|
|
6
|
-
trackCreation: { type: Boolean, default: false },
|
|
7
|
-
trackDeletion: { type: Boolean, default: false },
|
|
8
|
-
descriptionResolutorForExternalData: { type: String, default: null },
|
|
9
|
-
descriptionResolutorForDeletion: { type: String, default: null },
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const AuditConfigModel = mongoose.models.AuditConfig || mongoose.model('AuditConfig', auditConfigSchema);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export default AuditConfigModel;
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const auditConfigSchema = new mongoose.Schema({
|
|
4
|
+
collectionName: String,
|
|
5
|
+
fields: [String],
|
|
6
|
+
trackCreation: { type: Boolean, default: false },
|
|
7
|
+
trackDeletion: { type: Boolean, default: false },
|
|
8
|
+
descriptionResolutorForExternalData: { type: String, default: null },
|
|
9
|
+
descriptionResolutorForDeletion: { type: String, default: null },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const AuditConfigModel = mongoose.models.AuditConfig || mongoose.model('AuditConfig', auditConfigSchema);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export default AuditConfigModel;
|
package/models/audit.model.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
const auditSchema = new mongoose.Schema({
|
|
4
|
-
name: String,
|
|
5
|
-
recordId: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
contextId: mongoose.Schema.Types.ObjectId,
|
|
7
|
-
oldValue: mongoose.Schema.Types.Mixed,
|
|
8
|
-
newValue: mongoose.Schema.Types.Mixed,
|
|
9
|
-
timestamp: { type: Date, default: Date.now },
|
|
10
|
-
createdBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
|
11
|
-
externalData: mongoose.Schema.Types.Mixed
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const AuditLog = mongoose.models.AuditLog || mongoose.model('AuditLog', auditSchema);
|
|
15
|
-
|
|
16
|
-
export default AuditLog;
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const auditSchema = new mongoose.Schema({
|
|
4
|
+
name: { type: String, default: null },
|
|
5
|
+
recordId: { type: mongoose.Schema.Types.ObjectId, default: null },
|
|
6
|
+
contextId: { type: mongoose.Schema.Types.ObjectId, default: null },
|
|
7
|
+
oldValue: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
8
|
+
newValue: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
9
|
+
timestamp: { type: Date, default: Date.now },
|
|
10
|
+
createdBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
11
|
+
externalData: { type: mongoose.Schema.Types.Mixed, default: null }
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const AuditLog = mongoose.models.AuditLog || mongoose.model('AuditLog', auditSchema);
|
|
15
|
+
|
|
16
|
+
export default AuditLog;
|
|
@@ -1,269 +1,269 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
const optionSchema = new mongoose.Schema({
|
|
4
|
-
label: { type: mongoose.Schema.Types.Mixed },
|
|
5
|
-
value: { type: mongoose.Schema.Types.Mixed },
|
|
6
|
-
text: { type: mongoose.Schema.Types.Mixed }
|
|
7
|
-
|
|
8
|
-
}, { _id: false });
|
|
9
|
-
|
|
10
|
-
const formfieldSchema = new mongoose.Schema({
|
|
11
|
-
isFutureDateBlocked: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
},
|
|
14
|
-
addToPayload: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: false
|
|
17
|
-
},
|
|
18
|
-
fieldName: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true,
|
|
21
|
-
trim: true
|
|
22
|
-
},
|
|
23
|
-
isHidden: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: false
|
|
26
|
-
},
|
|
27
|
-
isEditable: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: true
|
|
30
|
-
},
|
|
31
|
-
size: {
|
|
32
|
-
type: Number,
|
|
33
|
-
default: 6,
|
|
34
|
-
enum: [3, 4, 6, 8, 10, 12],
|
|
35
|
-
},
|
|
36
|
-
layout: {
|
|
37
|
-
type: String,
|
|
38
|
-
enum: ['horizontal', 'vertical'],
|
|
39
|
-
},
|
|
40
|
-
label: {
|
|
41
|
-
type: String,
|
|
42
|
-
required: true,
|
|
43
|
-
trim: true
|
|
44
|
-
},
|
|
45
|
-
dataType: {
|
|
46
|
-
type: String,
|
|
47
|
-
required: true,
|
|
48
|
-
enum: ['text-area', 'string', 'number', 'boolean-check', 'boolean-radio', 'percentage', 'date', 'array', 'object', 'select', 'radio', 'drop-down', 'sort-code', 'post-code', 'pound', 'lookup', 'multi-select', 'email', 'phone', 'internationalPhone', 'account-number', '
|
|
49
|
-
},
|
|
50
|
-
isRequired: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false
|
|
53
|
-
},
|
|
54
|
-
helpText: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: null
|
|
57
|
-
},
|
|
58
|
-
isForceUpdate: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false
|
|
61
|
-
},
|
|
62
|
-
isShowClearIcon: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: true
|
|
65
|
-
},
|
|
66
|
-
requiredErrorMessage: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: 'Field is required'
|
|
69
|
-
},
|
|
70
|
-
defaultValue: {
|
|
71
|
-
type: mongoose.Schema.Types.Mixed
|
|
72
|
-
},
|
|
73
|
-
validationRules: [{
|
|
74
|
-
type: mongoose.Schema.Types.Mixed,
|
|
75
|
-
default: {}
|
|
76
|
-
}],
|
|
77
|
-
visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
|
|
78
|
-
type: mongoose.Schema.Types.Mixed,
|
|
79
|
-
default: null
|
|
80
|
-
},
|
|
81
|
-
options: [optionSchema],
|
|
82
|
-
section: {
|
|
83
|
-
type: String,
|
|
84
|
-
default: null
|
|
85
|
-
},
|
|
86
|
-
keyIconClass: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: null
|
|
89
|
-
},
|
|
90
|
-
keyIconStyle: {
|
|
91
|
-
type: Object,
|
|
92
|
-
default: null
|
|
93
|
-
},
|
|
94
|
-
// Ex: sort-code, post-code, pound, drop-down, lookup
|
|
95
|
-
uiHint: {
|
|
96
|
-
type: String
|
|
97
|
-
},
|
|
98
|
-
list: {
|
|
99
|
-
name: { // Lookup.BusinessType, DocumentType(collection)
|
|
100
|
-
type: String
|
|
101
|
-
},
|
|
102
|
-
label: { // name
|
|
103
|
-
type: String
|
|
104
|
-
},
|
|
105
|
-
value: { // _id
|
|
106
|
-
type: String
|
|
107
|
-
},
|
|
108
|
-
listFilterQuery: { // MongoDB query ex: applicationId:applicationId
|
|
109
|
-
type: mongoose.Schema.Types.Mixed,
|
|
110
|
-
default: null
|
|
111
|
-
},
|
|
112
|
-
dynamicSource: {
|
|
113
|
-
sourceMapping: [{
|
|
114
|
-
sourceField: {
|
|
115
|
-
type: String,
|
|
116
|
-
default: null
|
|
117
|
-
},
|
|
118
|
-
sourceValue: { type: mongoose.Schema.Types.Mixed },
|
|
119
|
-
listName: { type: String }, // The collection name to use when source field has this value
|
|
120
|
-
fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
|
|
121
|
-
}]
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
isSyncEnabled: { // Fixed typo (was isSyncEnabed)
|
|
125
|
-
type: Boolean,
|
|
126
|
-
default: true
|
|
127
|
-
},
|
|
128
|
-
dataElement: { //<collectionName>.<fieldName>
|
|
129
|
-
type: String,
|
|
130
|
-
default: null
|
|
131
|
-
},
|
|
132
|
-
syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
|
|
133
|
-
type: String,
|
|
134
|
-
default: null
|
|
135
|
-
},
|
|
136
|
-
syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
|
|
137
|
-
order: {
|
|
138
|
-
type: Number,
|
|
139
|
-
default: 0
|
|
140
|
-
},
|
|
141
|
-
maxLength: {
|
|
142
|
-
type: Number,
|
|
143
|
-
default: null,
|
|
144
|
-
min: 0
|
|
145
|
-
},
|
|
146
|
-
maxValue: { // this is not required used only when given else ignore ex- 100% max
|
|
147
|
-
type: mongoose.Schema.Types.Mixed
|
|
148
|
-
},
|
|
149
|
-
minValue: { // this is not required used only when given else ignore ex- 0% min
|
|
150
|
-
type: Number
|
|
151
|
-
},
|
|
152
|
-
isReadOnly: {
|
|
153
|
-
type: Boolean,
|
|
154
|
-
default: false
|
|
155
|
-
},
|
|
156
|
-
collectionName: { // name of collection for field if field doesnt belong to main collection
|
|
157
|
-
type: String,
|
|
158
|
-
default: null
|
|
159
|
-
},
|
|
160
|
-
foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
|
|
161
|
-
type: String,
|
|
162
|
-
default: null
|
|
163
|
-
},
|
|
164
|
-
shouldfilterOptionsAfterAdd: {
|
|
165
|
-
type : Boolean,
|
|
166
|
-
default : false
|
|
167
|
-
},
|
|
168
|
-
shouldfilterOptionsAfterDelete: {
|
|
169
|
-
type : Boolean,
|
|
170
|
-
default : false
|
|
171
|
-
}
|
|
172
|
-
}, { timestamps: true, _id: false });
|
|
173
|
-
|
|
174
|
-
const formConfigurationSchema = new mongoose.Schema({
|
|
175
|
-
formName: {
|
|
176
|
-
type: String,
|
|
177
|
-
required: true,
|
|
178
|
-
trim: true,
|
|
179
|
-
unique: true // Consider making form names unique
|
|
180
|
-
},
|
|
181
|
-
collectionName: {
|
|
182
|
-
type: String,
|
|
183
|
-
required: true
|
|
184
|
-
},
|
|
185
|
-
sectionLayout: {
|
|
186
|
-
type: String,
|
|
187
|
-
trim: true
|
|
188
|
-
},
|
|
189
|
-
parentKey: String,
|
|
190
|
-
populations: [Object],
|
|
191
|
-
visibilityCondition: {
|
|
192
|
-
type: mongoose.Schema.Types.Mixed,
|
|
193
|
-
default: null
|
|
194
|
-
},
|
|
195
|
-
sections: [{
|
|
196
|
-
sectionName: {
|
|
197
|
-
type: String,
|
|
198
|
-
trim: true
|
|
199
|
-
},
|
|
200
|
-
sectionLabel: {
|
|
201
|
-
type: String,
|
|
202
|
-
trim: true
|
|
203
|
-
},
|
|
204
|
-
isArray: {
|
|
205
|
-
type: Boolean,
|
|
206
|
-
default: false
|
|
207
|
-
},
|
|
208
|
-
isTable: {
|
|
209
|
-
type: Boolean,
|
|
210
|
-
default: false
|
|
211
|
-
},
|
|
212
|
-
dataFromSectionName: {
|
|
213
|
-
type: Boolean,
|
|
214
|
-
default: false
|
|
215
|
-
},
|
|
216
|
-
fields: [formfieldSchema],
|
|
217
|
-
order: {
|
|
218
|
-
type: Number,
|
|
219
|
-
default: 0
|
|
220
|
-
},
|
|
221
|
-
visibilityCondition: { // Added section-level visibility
|
|
222
|
-
type: mongoose.Schema.Types.Mixed,
|
|
223
|
-
default: null
|
|
224
|
-
},
|
|
225
|
-
sections: [{
|
|
226
|
-
sectionName: {
|
|
227
|
-
type: String,
|
|
228
|
-
trim: true
|
|
229
|
-
},
|
|
230
|
-
sectionLabel: {
|
|
231
|
-
type: String,
|
|
232
|
-
trim: true
|
|
233
|
-
},
|
|
234
|
-
fields: [formfieldSchema],
|
|
235
|
-
order: {
|
|
236
|
-
type: Number,
|
|
237
|
-
default: 0
|
|
238
|
-
},
|
|
239
|
-
isTable: {
|
|
240
|
-
type: Boolean,
|
|
241
|
-
default: false
|
|
242
|
-
},
|
|
243
|
-
visibilityCondition: { // Added section-level visibility
|
|
244
|
-
type: mongoose.Schema.Types.Mixed,
|
|
245
|
-
default: null
|
|
246
|
-
}
|
|
247
|
-
}]
|
|
248
|
-
}],
|
|
249
|
-
isActive: { // Consider adding status flag
|
|
250
|
-
type: Boolean,
|
|
251
|
-
default: true
|
|
252
|
-
},
|
|
253
|
-
isDeleteApprivoSync: {
|
|
254
|
-
type: Boolean,
|
|
255
|
-
default: true
|
|
256
|
-
},
|
|
257
|
-
isCreateApprivoSync: {
|
|
258
|
-
type: Boolean,
|
|
259
|
-
default: true
|
|
260
|
-
},
|
|
261
|
-
version: { // Consider adding versioning
|
|
262
|
-
type: Number,
|
|
263
|
-
default: 1
|
|
264
|
-
}
|
|
265
|
-
}, { timestamps: true });
|
|
266
|
-
|
|
267
|
-
const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
|
|
268
|
-
|
|
269
|
-
export default FormConfigurationModel;
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const optionSchema = new mongoose.Schema({
|
|
4
|
+
label: { type: mongoose.Schema.Types.Mixed },
|
|
5
|
+
value: { type: mongoose.Schema.Types.Mixed },
|
|
6
|
+
text: { type: mongoose.Schema.Types.Mixed }
|
|
7
|
+
|
|
8
|
+
}, { _id: false });
|
|
9
|
+
|
|
10
|
+
const formfieldSchema = new mongoose.Schema({
|
|
11
|
+
isFutureDateBlocked: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
},
|
|
14
|
+
addToPayload: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
fieldName: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
trim: true
|
|
22
|
+
},
|
|
23
|
+
isHidden: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
isEditable: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 6,
|
|
34
|
+
enum: [3, 4, 6, 8, 10, 12],
|
|
35
|
+
},
|
|
36
|
+
layout: {
|
|
37
|
+
type: String,
|
|
38
|
+
enum: ['horizontal', 'vertical'],
|
|
39
|
+
},
|
|
40
|
+
label: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: true,
|
|
43
|
+
trim: true
|
|
44
|
+
},
|
|
45
|
+
dataType: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: true,
|
|
48
|
+
enum: ['text-area', 'string', 'number', 'boolean-check', 'boolean-radio', 'percentage', 'date', 'array', 'object', 'select', 'radio', 'drop-down', 'sort-code', 'post-code', 'pound', 'lookup', 'multi-select', 'email', 'phone', 'internationalPhone', 'account-number', 'table-text-area'] // Added common form field types
|
|
49
|
+
},
|
|
50
|
+
isRequired: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
helpText: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
isForceUpdate: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
isShowClearIcon: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
requiredErrorMessage: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'Field is required'
|
|
69
|
+
},
|
|
70
|
+
defaultValue: {
|
|
71
|
+
type: mongoose.Schema.Types.Mixed
|
|
72
|
+
},
|
|
73
|
+
validationRules: [{
|
|
74
|
+
type: mongoose.Schema.Types.Mixed,
|
|
75
|
+
default: {}
|
|
76
|
+
}],
|
|
77
|
+
visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
|
|
78
|
+
type: mongoose.Schema.Types.Mixed,
|
|
79
|
+
default: null
|
|
80
|
+
},
|
|
81
|
+
options: [optionSchema],
|
|
82
|
+
section: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: null
|
|
85
|
+
},
|
|
86
|
+
keyIconClass: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: null
|
|
89
|
+
},
|
|
90
|
+
keyIconStyle: {
|
|
91
|
+
type: Object,
|
|
92
|
+
default: null
|
|
93
|
+
},
|
|
94
|
+
// Ex: sort-code, post-code, pound, drop-down, lookup
|
|
95
|
+
uiHint: {
|
|
96
|
+
type: String
|
|
97
|
+
},
|
|
98
|
+
list: {
|
|
99
|
+
name: { // Lookup.BusinessType, DocumentType(collection)
|
|
100
|
+
type: String
|
|
101
|
+
},
|
|
102
|
+
label: { // name
|
|
103
|
+
type: String
|
|
104
|
+
},
|
|
105
|
+
value: { // _id
|
|
106
|
+
type: String
|
|
107
|
+
},
|
|
108
|
+
listFilterQuery: { // MongoDB query ex: applicationId:applicationId
|
|
109
|
+
type: mongoose.Schema.Types.Mixed,
|
|
110
|
+
default: null
|
|
111
|
+
},
|
|
112
|
+
dynamicSource: {
|
|
113
|
+
sourceMapping: [{
|
|
114
|
+
sourceField: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: null
|
|
117
|
+
},
|
|
118
|
+
sourceValue: { type: mongoose.Schema.Types.Mixed },
|
|
119
|
+
listName: { type: String }, // The collection name to use when source field has this value
|
|
120
|
+
fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
|
|
121
|
+
}]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
isSyncEnabled: { // Fixed typo (was isSyncEnabed)
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: true
|
|
127
|
+
},
|
|
128
|
+
dataElement: { //<collectionName>.<fieldName>
|
|
129
|
+
type: String,
|
|
130
|
+
default: null
|
|
131
|
+
},
|
|
132
|
+
syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
|
|
133
|
+
type: String,
|
|
134
|
+
default: null
|
|
135
|
+
},
|
|
136
|
+
syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
|
|
137
|
+
order: {
|
|
138
|
+
type: Number,
|
|
139
|
+
default: 0
|
|
140
|
+
},
|
|
141
|
+
maxLength: {
|
|
142
|
+
type: Number,
|
|
143
|
+
default: null,
|
|
144
|
+
min: 0
|
|
145
|
+
},
|
|
146
|
+
maxValue: { // this is not required used only when given else ignore ex- 100% max
|
|
147
|
+
type: mongoose.Schema.Types.Mixed
|
|
148
|
+
},
|
|
149
|
+
minValue: { // this is not required used only when given else ignore ex- 0% min
|
|
150
|
+
type: Number
|
|
151
|
+
},
|
|
152
|
+
isReadOnly: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: false
|
|
155
|
+
},
|
|
156
|
+
collectionName: { // name of collection for field if field doesnt belong to main collection
|
|
157
|
+
type: String,
|
|
158
|
+
default: null
|
|
159
|
+
},
|
|
160
|
+
foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
|
|
161
|
+
type: String,
|
|
162
|
+
default: null
|
|
163
|
+
},
|
|
164
|
+
shouldfilterOptionsAfterAdd: {
|
|
165
|
+
type : Boolean,
|
|
166
|
+
default : false
|
|
167
|
+
},
|
|
168
|
+
shouldfilterOptionsAfterDelete: {
|
|
169
|
+
type : Boolean,
|
|
170
|
+
default : false
|
|
171
|
+
}
|
|
172
|
+
}, { timestamps: true, _id: false });
|
|
173
|
+
|
|
174
|
+
const formConfigurationSchema = new mongoose.Schema({
|
|
175
|
+
formName: {
|
|
176
|
+
type: String,
|
|
177
|
+
required: true,
|
|
178
|
+
trim: true,
|
|
179
|
+
unique: true // Consider making form names unique
|
|
180
|
+
},
|
|
181
|
+
collectionName: {
|
|
182
|
+
type: String,
|
|
183
|
+
required: true
|
|
184
|
+
},
|
|
185
|
+
sectionLayout: {
|
|
186
|
+
type: String,
|
|
187
|
+
trim: true
|
|
188
|
+
},
|
|
189
|
+
parentKey: String,
|
|
190
|
+
populations: [Object],
|
|
191
|
+
visibilityCondition: {
|
|
192
|
+
type: mongoose.Schema.Types.Mixed,
|
|
193
|
+
default: null
|
|
194
|
+
},
|
|
195
|
+
sections: [{
|
|
196
|
+
sectionName: {
|
|
197
|
+
type: String,
|
|
198
|
+
trim: true
|
|
199
|
+
},
|
|
200
|
+
sectionLabel: {
|
|
201
|
+
type: String,
|
|
202
|
+
trim: true
|
|
203
|
+
},
|
|
204
|
+
isArray: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: false
|
|
207
|
+
},
|
|
208
|
+
isTable: {
|
|
209
|
+
type: Boolean,
|
|
210
|
+
default: false
|
|
211
|
+
},
|
|
212
|
+
dataFromSectionName: {
|
|
213
|
+
type: Boolean,
|
|
214
|
+
default: false
|
|
215
|
+
},
|
|
216
|
+
fields: [formfieldSchema],
|
|
217
|
+
order: {
|
|
218
|
+
type: Number,
|
|
219
|
+
default: 0
|
|
220
|
+
},
|
|
221
|
+
visibilityCondition: { // Added section-level visibility
|
|
222
|
+
type: mongoose.Schema.Types.Mixed,
|
|
223
|
+
default: null
|
|
224
|
+
},
|
|
225
|
+
sections: [{
|
|
226
|
+
sectionName: {
|
|
227
|
+
type: String,
|
|
228
|
+
trim: true
|
|
229
|
+
},
|
|
230
|
+
sectionLabel: {
|
|
231
|
+
type: String,
|
|
232
|
+
trim: true
|
|
233
|
+
},
|
|
234
|
+
fields: [formfieldSchema],
|
|
235
|
+
order: {
|
|
236
|
+
type: Number,
|
|
237
|
+
default: 0
|
|
238
|
+
},
|
|
239
|
+
isTable: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
default: false
|
|
242
|
+
},
|
|
243
|
+
visibilityCondition: { // Added section-level visibility
|
|
244
|
+
type: mongoose.Schema.Types.Mixed,
|
|
245
|
+
default: null
|
|
246
|
+
}
|
|
247
|
+
}]
|
|
248
|
+
}],
|
|
249
|
+
isActive: { // Consider adding status flag
|
|
250
|
+
type: Boolean,
|
|
251
|
+
default: true
|
|
252
|
+
},
|
|
253
|
+
isDeleteApprivoSync: {
|
|
254
|
+
type: Boolean,
|
|
255
|
+
default: true
|
|
256
|
+
},
|
|
257
|
+
isCreateApprivoSync: {
|
|
258
|
+
type: Boolean,
|
|
259
|
+
default: true
|
|
260
|
+
},
|
|
261
|
+
version: { // Consider adding versioning
|
|
262
|
+
type: Number,
|
|
263
|
+
default: 1
|
|
264
|
+
}
|
|
265
|
+
}, { timestamps: true });
|
|
266
|
+
|
|
267
|
+
const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
|
|
268
|
+
|
|
269
|
+
export default FormConfigurationModel;
|
package/models/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as AuditConfigModel } from './audit-config.model.js';
|
|
2
|
-
export { default as AuditModel } from './audit.model.js';
|
|
3
|
-
export { default as ValueReferenceMapModel } from './value-reference-map.model.js';
|
|
1
|
+
export { default as AuditConfigModel } from './audit-config.model.js';
|
|
2
|
+
export { default as AuditModel } from './audit.model.js';
|
|
3
|
+
export { default as ValueReferenceMapModel } from './value-reference-map.model.js';
|
|
4
4
|
export { default as FormConfigurationModel } from './form-configuration.model.js';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
const valueReferenceMapSchema = new mongoose.Schema({
|
|
4
|
-
field: String, // e.g. 'documentTypeId', 'createdBy', 'status'
|
|
5
|
-
model: String, // e.g. 'DocumentType', 'User', 'ApplicationStatus'
|
|
6
|
-
displayField: String, // e.g. 'name', 'fullName', 'label'
|
|
7
|
-
descriptionResolverType: { type: String, enum: ['direct', 'lookup', 'composite', 'custom'], default: 'direct' },
|
|
8
|
-
descriptionField: String, // for direct/lookup
|
|
9
|
-
descriptionFields: [String], // for composite
|
|
10
|
-
descriptionFunction: String // for custom
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
valueReferenceMapSchema.index({ field: 1 }, { unique: true });
|
|
14
|
-
|
|
15
|
-
const ValueReferenceMapModel = mongoose.models.ValueReferenceMap || mongoose.model('ValueReferenceMap', valueReferenceMapSchema);
|
|
16
|
-
export default ValueReferenceMapModel;
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const valueReferenceMapSchema = new mongoose.Schema({
|
|
4
|
+
field: String, // e.g. 'documentTypeId', 'createdBy', 'status'
|
|
5
|
+
model: String, // e.g. 'DocumentType', 'User', 'ApplicationStatus'
|
|
6
|
+
displayField: String, // e.g. 'name', 'fullName', 'label'
|
|
7
|
+
descriptionResolverType: { type: String, enum: ['direct', 'lookup', 'composite', 'custom'], default: 'direct' },
|
|
8
|
+
descriptionField: String, // for direct/lookup
|
|
9
|
+
descriptionFields: [String], // for composite
|
|
10
|
+
descriptionFunction: String // for custom
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
valueReferenceMapSchema.index({ field: 1 }, { unique: true });
|
|
14
|
+
|
|
15
|
+
const ValueReferenceMapModel = mongoose.models.ValueReferenceMap || mongoose.model('ValueReferenceMap', valueReferenceMapSchema);
|
|
16
|
+
export default ValueReferenceMapModel;
|