@dynamatix/cat-shared 0.0.72 → 0.0.73
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.
|
@@ -45,7 +45,7 @@ function applyAuditMiddleware(schema, collectionName) {
|
|
|
45
45
|
|
|
46
46
|
const log = {
|
|
47
47
|
name: `${collectionName} created`,
|
|
48
|
-
recordId: doc._id,
|
|
48
|
+
recordId: contextId || doc._id,
|
|
49
49
|
oldValue: null,
|
|
50
50
|
newValue: 'Document created',
|
|
51
51
|
createdBy: userId,
|
|
@@ -53,6 +53,7 @@ function applyAuditMiddleware(schema, collectionName) {
|
|
|
53
53
|
};
|
|
54
54
|
if (auditConfig.descriptionResolutorForExternalData) {
|
|
55
55
|
log.externalData.description = await resolveExternalData(auditConfig.descriptionResolutorForExternalData, doc[descriptionResolutorForExternalData])
|
|
56
|
+
log.externalData.contextId = contextId;
|
|
56
57
|
}
|
|
57
58
|
await AuditLog.create(log);
|
|
58
59
|
|
|
@@ -96,14 +97,14 @@ function applyAuditMiddleware(schema, collectionName) {
|
|
|
96
97
|
let externalData={};
|
|
97
98
|
if (auditConfig.descriptionResolutorForExternalData) {
|
|
98
99
|
externalData.description = await resolveExternalData(auditConfig.descriptionResolutorForExternalData, result[auditConfig.descriptionResolutorForExternalData])
|
|
100
|
+
externalData.contextId = contextId || result._id;
|
|
99
101
|
}
|
|
100
102
|
logs.push({
|
|
101
103
|
name: `${collectionName}.${field}`,
|
|
102
|
-
recordId: result._id,
|
|
104
|
+
recordId: contextId || result._id,
|
|
103
105
|
oldValue: resolvedOld,
|
|
104
106
|
newValue: resolvedNew,
|
|
105
107
|
createdBy: userId,
|
|
106
|
-
contextId,
|
|
107
108
|
externalData
|
|
108
109
|
});
|
|
109
110
|
}
|