@dynamatix/cat-shared 0.0.123 → 0.0.125

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,269 +1,273 @@
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', 'counter-input', '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;
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', 'counter-input', '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
+ lookupDefaultValue: {
74
+ lookupGroupName: { type: String },
75
+ lookupName: { type: String }
76
+ },
77
+ validationRules: [{
78
+ type: mongoose.Schema.Types.Mixed,
79
+ default: {}
80
+ }],
81
+ visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
82
+ type: mongoose.Schema.Types.Mixed,
83
+ default: null
84
+ },
85
+ options: [optionSchema],
86
+ section: {
87
+ type: String,
88
+ default: null
89
+ },
90
+ keyIconClass: {
91
+ type: String,
92
+ default: null
93
+ },
94
+ keyIconStyle: {
95
+ type: Object,
96
+ default: null
97
+ },
98
+ // Ex: sort-code, post-code, pound, drop-down, lookup
99
+ uiHint: {
100
+ type: String
101
+ },
102
+ list: {
103
+ name: { // Lookup.BusinessType, DocumentType(collection)
104
+ type: String
105
+ },
106
+ label: { // name
107
+ type: String
108
+ },
109
+ value: { // _id
110
+ type: String
111
+ },
112
+ listFilterQuery: { // MongoDB query ex: applicationId:applicationId
113
+ type: mongoose.Schema.Types.Mixed,
114
+ default: null
115
+ },
116
+ dynamicSource: {
117
+ sourceMapping: [{
118
+ sourceField: {
119
+ type: String,
120
+ default: null
121
+ },
122
+ sourceValue: { type: mongoose.Schema.Types.Mixed },
123
+ listName: { type: String }, // The collection name to use when source field has this value
124
+ fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
125
+ }]
126
+ }
127
+ },
128
+ isSyncEnabled: { // Fixed typo (was isSyncEnabed)
129
+ type: Boolean,
130
+ default: true
131
+ },
132
+ dataElement: { //<collectionName>.<fieldName>
133
+ type: String,
134
+ default: null
135
+ },
136
+ syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
137
+ type: String,
138
+ default: null
139
+ },
140
+ syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
141
+ order: {
142
+ type: Number,
143
+ default: 0
144
+ },
145
+ maxLength: {
146
+ type: Number,
147
+ default: null,
148
+ min: 0
149
+ },
150
+ maxValue: { // this is not required used only when given else ignore ex- 100% max
151
+ type: mongoose.Schema.Types.Mixed
152
+ },
153
+ minValue: { // this is not required used only when given else ignore ex- 0% min
154
+ type: Number
155
+ },
156
+ isReadOnly: {
157
+ type: Boolean,
158
+ default: false
159
+ },
160
+ collectionName: { // name of collection for field if field doesnt belong to main collection
161
+ type: String,
162
+ default: null
163
+ },
164
+ foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
165
+ type: String,
166
+ default: null
167
+ },
168
+ shouldfilterOptionsAfterAdd: {
169
+ type: Boolean,
170
+ default: false
171
+ },
172
+ shouldfilterOptionsAfterDelete: {
173
+ type: Boolean,
174
+ default: false
175
+ }
176
+ }, { timestamps: true, _id: false });
177
+
178
+ const formConfigurationSchema = new mongoose.Schema({
179
+ formName: {
180
+ type: String,
181
+ required: true,
182
+ trim: true,
183
+ unique: true // Consider making form names unique
184
+ },
185
+ collectionName: {
186
+ type: String,
187
+ required: true
188
+ },
189
+ sectionLayout: {
190
+ type: String,
191
+ trim: true
192
+ },
193
+ parentKey: String,
194
+ populations: [Object],
195
+ visibilityCondition: {
196
+ type: mongoose.Schema.Types.Mixed,
197
+ default: null
198
+ },
199
+ sections: [{
200
+ sectionName: {
201
+ type: String,
202
+ trim: true
203
+ },
204
+ sectionLabel: {
205
+ type: String,
206
+ trim: true
207
+ },
208
+ isArray: {
209
+ type: Boolean,
210
+ default: false
211
+ },
212
+ isTable: {
213
+ type: Boolean,
214
+ default: false
215
+ },
216
+ dataFromSectionName: {
217
+ type: Boolean,
218
+ default: false
219
+ },
220
+ fields: [formfieldSchema],
221
+ order: {
222
+ type: Number,
223
+ default: 0
224
+ },
225
+ visibilityCondition: { // Added section-level visibility
226
+ type: mongoose.Schema.Types.Mixed,
227
+ default: null
228
+ },
229
+ sections: [{
230
+ sectionName: {
231
+ type: String,
232
+ trim: true
233
+ },
234
+ sectionLabel: {
235
+ type: String,
236
+ trim: true
237
+ },
238
+ fields: [formfieldSchema],
239
+ order: {
240
+ type: Number,
241
+ default: 0
242
+ },
243
+ isTable: {
244
+ type: Boolean,
245
+ default: false
246
+ },
247
+ visibilityCondition: { // Added section-level visibility
248
+ type: mongoose.Schema.Types.Mixed,
249
+ default: null
250
+ }
251
+ }]
252
+ }],
253
+ isActive: { // Consider adding status flag
254
+ type: Boolean,
255
+ default: true
256
+ },
257
+ isDeleteApprivoSync: {
258
+ type: Boolean,
259
+ default: true
260
+ },
261
+ isCreateApprivoSync: {
262
+ type: Boolean,
263
+ default: true
264
+ },
265
+ version: { // Consider adding versioning
266
+ type: Number,
267
+ default: 1
268
+ }
269
+ }, { timestamps: true });
270
+
271
+ const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
272
+
273
+ export default FormConfigurationModel;
package/models/index.js CHANGED
@@ -1,11 +1,11 @@
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
- export { default as FormConfigurationModel } from './form-configuration.model.js';
5
- export { default as DocumentTypeModel } from './document-type.model.js';
6
- export { default as DocumentModel } from './document.model.js';
7
- export { default as WorkflowAlertModel } from './workflow-alert.model.js';
8
- export { default as WorkflowConfigModel } from './workflow-config.model.js';
9
- export { default as DocumentHistoryModel } from './document-history.model.js';
10
- export { default as MetaModel } from './meta.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
+ export { default as FormConfigurationModel } from './form-configuration.model.js';
5
+ export { default as DocumentTypeModel } from './document-type.model.js';
6
+ export { default as DocumentModel } from './document.model.js';
7
+ export { default as WorkflowAlertModel } from './workflow-alert.model.js';
8
+ export { default as WorkflowConfigModel } from './workflow-config.model.js';
9
+ export { default as DocumentHistoryModel } from './document-history.model.js';
10
+ export { default as MetaModel } from './meta.model.js';
11
11
  export { default as PropertyMetaDataModel } from './property-metadata.model.js';
@@ -1,10 +1,10 @@
1
- import mongoose from 'mongoose';
2
-
3
- const metaSchema = new mongoose.Schema({
4
- solutionId: { type: String, required: true },
5
- solutionName: { type: String, required: true },
6
- solutionDescription: { type: String },
7
- }, { timestamps: true });
8
-
9
- const MetaModel = mongoose.models.Meta || mongoose.model('Meta', metaSchema);
1
+ import mongoose from 'mongoose';
2
+
3
+ const metaSchema = new mongoose.Schema({
4
+ solutionId: { type: String, required: true },
5
+ solutionName: { type: String, required: true },
6
+ solutionDescription: { type: String },
7
+ }, { timestamps: true });
8
+
9
+ const MetaModel = mongoose.models.Meta || mongoose.model('Meta', metaSchema);
10
10
  export default MetaModel;