@dynamatix/cat-shared 0.0.104 → 0.0.106
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/models/index.js
CHANGED
|
@@ -2,5 +2,7 @@ export { default as AuditConfigModel } from './audit-config.model.js';
|
|
|
2
2
|
export { default as AuditModel } from './audit.model.js';
|
|
3
3
|
export { default as ValueReferenceMapModel } from './value-reference-map.model.js';
|
|
4
4
|
export { default as FormConfigurationModel } from './form-configuration.model.js';
|
|
5
|
-
export { default as DocumentTypeModel } from './document-type
|
|
6
|
-
export { default as DocumentModel } from './document.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';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const { Schema, model } = mongoose;
|
|
3
|
+
|
|
4
|
+
const alertSchema = new Schema({
|
|
5
|
+
contextId: {
|
|
6
|
+
type: Schema.Types.ObjectId,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
source: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
index: true
|
|
13
|
+
},
|
|
14
|
+
sourceId: {
|
|
15
|
+
type: Schema.Types.ObjectId,
|
|
16
|
+
required: true,
|
|
17
|
+
index: true
|
|
18
|
+
},
|
|
19
|
+
alertMessage: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: false
|
|
22
|
+
},
|
|
23
|
+
category: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: false,
|
|
26
|
+
index: true
|
|
27
|
+
},
|
|
28
|
+
isActive: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
required: true,
|
|
31
|
+
default: true,
|
|
32
|
+
index: true
|
|
33
|
+
},
|
|
34
|
+
status: {
|
|
35
|
+
|
|
36
|
+
type: String,
|
|
37
|
+
required: true,
|
|
38
|
+
enum: ['raised', 'satisfied'],
|
|
39
|
+
index: true
|
|
40
|
+
},
|
|
41
|
+
rationaleMessage: { type: String },
|
|
42
|
+
formName: { type: Array },
|
|
43
|
+
timestamp: {
|
|
44
|
+
type: Date,
|
|
45
|
+
required: true,
|
|
46
|
+
default: Date.now,
|
|
47
|
+
index: true
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
timestamps: true
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Compound index for efficient querying
|
|
54
|
+
alertSchema.index({ source: 1, sourceId: 1 });
|
|
55
|
+
alertSchema.index({ status: 1, isActive: 1 });
|
|
56
|
+
|
|
57
|
+
const WorkflowAlertModel = model('WorkflowAlert', alertSchema);
|
|
58
|
+
|
|
59
|
+
export default WorkflowAlertModel;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const { Schema, model } = mongoose;
|
|
3
|
+
|
|
4
|
+
const workflowConfigSchema = new Schema({
|
|
5
|
+
id: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
unique: true
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
tasks: {
|
|
15
|
+
type: [Schema.Types.Mixed],
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
trigger: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
validations: {
|
|
23
|
+
type: [Schema.Types.Mixed],
|
|
24
|
+
required: true
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
timestamps: true
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const WorkflowConfigModel = model('WorkflowConfig', workflowConfigSchema);
|
|
31
|
+
|
|
32
|
+
export default WorkflowConfigModel;
|