@dynamatix/cat-shared 0.0.70 → 0.0.72

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.
@@ -29,8 +29,8 @@ async function resolveExternalData(descriptionResolutorForExternalData, recordId
29
29
  const map = await ValueReferenceMap.findOne({ field: descriptionResolutorForExternalData });
30
30
  const Model = mongoose.models[map.model];
31
31
  if (!Model) return "";
32
- const doc = Model.findById(recordId).lean()
33
- return doc[descriptionResolutorForExternalData];
32
+ const doc = await Model.findById(recordId).lean()
33
+ return doc[map.displayField];
34
34
  }
35
35
 
36
36
  function applyAuditMiddleware(schema, collectionName) {
@@ -52,7 +52,7 @@ function applyAuditMiddleware(schema, collectionName) {
52
52
  contextId
53
53
  };
54
54
  if (auditConfig.descriptionResolutorForExternalData) {
55
- log.externalData.description = resolveExternalData(auditConfig.descriptionResolutorForExternalData, doc[descriptionResolutorForExternalData])
55
+ log.externalData.description = await resolveExternalData(auditConfig.descriptionResolutorForExternalData, doc[descriptionResolutorForExternalData])
56
56
  }
57
57
  await AuditLog.create(log);
58
58
 
@@ -95,7 +95,7 @@ function applyAuditMiddleware(schema, collectionName) {
95
95
 
96
96
  let externalData={};
97
97
  if (auditConfig.descriptionResolutorForExternalData) {
98
- externalData.description = resolveExternalData(auditConfig.descriptionResolutorForExternalData, doc[descriptionResolutorForExternalData])
98
+ externalData.description = await resolveExternalData(auditConfig.descriptionResolutorForExternalData, result[auditConfig.descriptionResolutorForExternalData])
99
99
  }
100
100
  logs.push({
101
101
  name: `${collectionName}.${field}`,
@@ -252,6 +252,6 @@ const formConfigurationSchema = new mongoose.Schema({
252
252
  }
253
253
  }, { timestamps: true });
254
254
 
255
- const FormConfigurationModel = mongoose.models.FormConfigurationModel || mongoose.model('FormConfiguration', formConfigurationSchema);
255
+ const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
256
256
 
257
257
  export default FormConfigurationModel;
@@ -8,5 +8,5 @@ const valueReferenceMapSchema = new mongoose.Schema({
8
8
 
9
9
  valueReferenceMapSchema.index({ field: 1 }, { unique: true });
10
10
 
11
- const ValueReferenceMapModel = mongoose.models.ValueReferenceMapModel || mongoose.model('ValueReferenceMap', valueReferenceMapSchema);
11
+ const ValueReferenceMapModel = mongoose.models.ValueReferenceMap || mongoose.model('ValueReferenceMap', valueReferenceMapSchema);
12
12
  export default ValueReferenceMapModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/cat-shared",
3
- "version": "0.0.70",
3
+ "version": "0.0.72",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"