@optimiser/common 1.0.332 → 1.0.333
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/dist/lib/utility.js +26 -1
- package/package.json +1 -1
package/dist/lib/utility.js
CHANGED
|
@@ -491,7 +491,32 @@ function GetFieldDetail(objectName, fieldName, db, callback, next) {
|
|
|
491
491
|
callback(data.Fields[0]);
|
|
492
492
|
}
|
|
493
493
|
else {
|
|
494
|
-
|
|
494
|
+
//if field not found then check in collection field
|
|
495
|
+
db.collection('ObjectSchema').findOne({ 'Name': objectName, "Fields.UIDataType": "collection", "Fields.Fields.Name": fieldName }, { projection: { _id: 0, Fields: 1 } }, function (err, data) {
|
|
496
|
+
if (err) {
|
|
497
|
+
next(err);
|
|
498
|
+
}
|
|
499
|
+
else if (data && data.Fields && data.Fields.length) {
|
|
500
|
+
var field = undefined;
|
|
501
|
+
var collectionFields = data.Fields.filter(function (x) { return x.UIDataType == "collection"; });
|
|
502
|
+
if (collectionFields) {
|
|
503
|
+
for (var i = 0; i < collectionFields.length; i++) {
|
|
504
|
+
var colField = collectionFields[0];
|
|
505
|
+
if (colField.Fields) {
|
|
506
|
+
field = colField.Fields.find(function (x) { return x.Name == fieldName; });
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
if (field)
|
|
512
|
+
callback(field);
|
|
513
|
+
else
|
|
514
|
+
callback({});
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
callback({});
|
|
518
|
+
}
|
|
519
|
+
});
|
|
495
520
|
}
|
|
496
521
|
});
|
|
497
522
|
}
|