@dynamatix/cat-shared 0.0.128 → 0.0.129

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,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;
@@ -1,16 +1,16 @@
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
+ 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,52 +1,52 @@
1
- import mongoose from "mongoose";
2
-
3
- const documentHistorySchema = new mongoose.Schema({
4
- linkToDocumentId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: "Document",
7
- required: false
8
- },
9
- respondedOn: { // when was the document responded
10
- type: Date,
11
- required: false
12
- },
13
- responderRemarks: { // remarks for response given by UW or Broker
14
- type: String,
15
- required: false
16
- },
17
- responderBy: { // who changed the status - user id
18
- type: String,
19
- required: false
20
- },
21
- docName: {
22
- type: String,
23
- required: false
24
- },
25
- contentType: {
26
- type: String,
27
- required: false
28
- },
29
- documentTypeId: {
30
- type: mongoose.Schema.Types.ObjectId,
31
- ref: "DocumentType",
32
- required: false
33
- },
34
- documentUrl: {
35
- type: String,
36
- required: false
37
- },
38
- fileSize: {
39
- type: String,
40
- required: false
41
- },
42
- externalData: { // will add any other external data here for future use
43
- type: mongoose.Schema.Types.Mixed,
44
- required: false,
45
- default: {}
46
- }
47
- }, {
48
- timestamps: false
49
- });
50
-
51
- const DocumentHistoryModel = mongoose.models.DocumentHistory || mongoose.model("DocumentHistory", documentHistorySchema);
1
+ import mongoose from "mongoose";
2
+
3
+ const documentHistorySchema = new mongoose.Schema({
4
+ linkToDocumentId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: "Document",
7
+ required: false
8
+ },
9
+ respondedOn: { // when was the document responded
10
+ type: Date,
11
+ required: false
12
+ },
13
+ responderRemarks: { // remarks for response given by UW or Broker
14
+ type: String,
15
+ required: false
16
+ },
17
+ responderBy: { // who changed the status - user id
18
+ type: String,
19
+ required: false
20
+ },
21
+ docName: {
22
+ type: String,
23
+ required: false
24
+ },
25
+ contentType: {
26
+ type: String,
27
+ required: false
28
+ },
29
+ documentTypeId: {
30
+ type: mongoose.Schema.Types.ObjectId,
31
+ ref: "DocumentType",
32
+ required: false
33
+ },
34
+ documentUrl: {
35
+ type: String,
36
+ required: false
37
+ },
38
+ fileSize: {
39
+ type: String,
40
+ required: false
41
+ },
42
+ externalData: { // will add any other external data here for future use
43
+ type: mongoose.Schema.Types.Mixed,
44
+ required: false,
45
+ default: {}
46
+ }
47
+ }, {
48
+ timestamps: false
49
+ });
50
+
51
+ const DocumentHistoryModel = mongoose.models.DocumentHistory || mongoose.model("DocumentHistory", documentHistorySchema);
52
52
  export default DocumentHistoryModel;
@@ -1,26 +1,26 @@
1
- import mongoose from "mongoose";
2
-
3
- const documentTypeSchema = new mongoose.Schema({
4
- name: { type: String, required: true },
5
- label: { type: String },
6
- linkedDocTypes: {
7
- type: [String], // Array of strings
8
- default: []
9
- },
10
- source: { type: String, enum: ['Applicant', 'Application'], default: null },
11
- parentDocumentTypeId: { type: mongoose.Schema.Types.ObjectId, ref: 'DocumentType', default: null },
12
- categoryDescription: { // description only for document categories and not doc types
13
- type: String,
14
- required: false,
15
- default: null
16
- },
17
- isForBroker: { // there are some doc types are not to be shown to broker
18
- type: Boolean,
19
- default: false
20
- },
21
- matchRules: { type: mongoose.Schema.Types.Mixed }
22
- });
23
-
24
- const DocumentTypeModel = mongoose.models.DocumentType || mongoose.model('DocumentType', documentTypeSchema);
25
-
1
+ import mongoose from "mongoose";
2
+
3
+ const documentTypeSchema = new mongoose.Schema({
4
+ name: { type: String, required: true },
5
+ label: { type: String },
6
+ linkedDocTypes: {
7
+ type: [String], // Array of strings
8
+ default: []
9
+ },
10
+ source: { type: String, enum: ['Applicant', 'Application'], default: null },
11
+ parentDocumentTypeId: { type: mongoose.Schema.Types.ObjectId, ref: 'DocumentType', default: null },
12
+ categoryDescription: { // description only for document categories and not doc types
13
+ type: String,
14
+ required: false,
15
+ default: null
16
+ },
17
+ isForBroker: { // there are some doc types are not to be shown to broker
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ matchRules: { type: mongoose.Schema.Types.Mixed }
22
+ });
23
+
24
+ const DocumentTypeModel = mongoose.models.DocumentType || mongoose.model('DocumentType', documentTypeSchema);
25
+
26
26
  export default DocumentTypeModel;
@@ -1,74 +1,74 @@
1
- import mongoose from "mongoose";
2
-
3
- const documentSchema = new mongoose.Schema({
4
- contextId: { // can be application or applicant
5
- type: mongoose.Schema.Types.ObjectId,
6
- required: false
7
- },
8
- externalDocumentId: { // docId by Apprivo
9
- type: String,
10
- default: null,
11
- required: false
12
- },
13
- filename: { // doc name to be shown in UI
14
- type: String,
15
- required: false
16
- },
17
- docName: { // doc name of uploaded file to be shown in UI
18
- type: String,
19
- required: false
20
- },
21
- contentType: {
22
- type: String,
23
- required: false
24
- },
25
- documentTypeId: {
26
- type: mongoose.Schema.Types.ObjectId,
27
- ref: "DocumentType",
28
- required: false
29
- },
30
- documentUrl: { // uploaded doc url
31
- type: String,
32
- required: false
33
- },
34
- statusLid: { // doc current status lookup id (pending, approved, rejected, ...)
35
- type: mongoose.Schema.Types.ObjectId,
36
- ref: "Lookup",
37
- required: false
38
- },
39
- fileSize: {
40
- type: String,
41
- required: false
42
- },
43
- uploadedOn: {
44
- type: Date,
45
- required: false
46
- },
47
- uploadedBy: {
48
- type: String,
49
- required: false
50
- },
51
- requesterDescription: { // description of the document request given by UW while requesting document
52
- type: String,
53
- default: "",
54
- },
55
- externalData: { // will add any other external data here
56
- type: mongoose.Schema.Types.Mixed,
57
- required: false,
58
- default: {}
59
- },
60
- aliasName: {
61
- type: String,
62
- default: ""
63
- }
64
- }, {
65
- timestamps: false
66
- });
67
-
68
- documentSchema.index({
69
- contextId: 1, externalDocumentId: 1, "externalData.checkFlowId": 1,
70
- "externalData.instanceId": 1,
71
- "externalData.isMainDocument": 1
72
- });
73
- const DocumentModel = mongoose.models.Document || mongoose.model("Document", documentSchema);
1
+ import mongoose from "mongoose";
2
+
3
+ const documentSchema = new mongoose.Schema({
4
+ contextId: { // can be application or applicant
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ required: false
7
+ },
8
+ externalDocumentId: { // docId by Apprivo
9
+ type: String,
10
+ default: null,
11
+ required: false
12
+ },
13
+ filename: { // doc name to be shown in UI
14
+ type: String,
15
+ required: false
16
+ },
17
+ docName: { // doc name of uploaded file to be shown in UI
18
+ type: String,
19
+ required: false
20
+ },
21
+ contentType: {
22
+ type: String,
23
+ required: false
24
+ },
25
+ documentTypeId: {
26
+ type: mongoose.Schema.Types.ObjectId,
27
+ ref: "DocumentType",
28
+ required: false
29
+ },
30
+ documentUrl: { // uploaded doc url
31
+ type: String,
32
+ required: false
33
+ },
34
+ statusLid: { // doc current status lookup id (pending, approved, rejected, ...)
35
+ type: mongoose.Schema.Types.ObjectId,
36
+ ref: "Lookup",
37
+ required: false
38
+ },
39
+ fileSize: {
40
+ type: String,
41
+ required: false
42
+ },
43
+ uploadedOn: {
44
+ type: Date,
45
+ required: false
46
+ },
47
+ uploadedBy: {
48
+ type: String,
49
+ required: false
50
+ },
51
+ requesterDescription: { // description of the document request given by UW while requesting document
52
+ type: String,
53
+ default: "",
54
+ },
55
+ externalData: { // will add any other external data here
56
+ type: mongoose.Schema.Types.Mixed,
57
+ required: false,
58
+ default: {}
59
+ },
60
+ aliasName: {
61
+ type: String,
62
+ default: ""
63
+ }
64
+ }, {
65
+ timestamps: false
66
+ });
67
+
68
+ documentSchema.index({
69
+ contextId: 1, externalDocumentId: 1, "externalData.checkFlowId": 1,
70
+ "externalData.instanceId": 1,
71
+ "externalData.isMainDocument": 1
72
+ });
73
+ const DocumentModel = mongoose.models.Document || mongoose.model("Document", documentSchema);
74
74
  export default DocumentModel;