@dynamatix/cat-shared 0.0.85 → 0.0.86

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.
@@ -104,13 +104,21 @@ function applyAuditMiddleware(schema, collectionName) {
104
104
  if (auditConfig.fields?.length) {
105
105
  for (const field of auditConfig.fields) {
106
106
  const newValue = doc[field];
107
+ if (field.endsWith('Lid')) {
108
+ const newlookupDoc = await mongoose.models['Lookup'].findById(newValue).lean();
109
+ if (newlookupDoc) {
110
+ lookupName = newlookupDoc.name;
111
+ } else {
112
+ lookupName = '';
113
+ }
114
+ }
107
115
  const fieldDescription = await resolveDescription(field, doc);
108
116
  logs.push({
109
117
  name: fieldDescription,
110
118
  entity: entityDescription,
111
119
  recordId: contextId || doc._id,
112
120
  oldValue: null,
113
- newValue,
121
+ newValue: lookupName || newValue,
114
122
  createdBy: userId,
115
123
  externalData: {
116
124
  description: entityDescription,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/cat-shared",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"