@optimiser/common 1.0.294 → 1.0.295

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.
@@ -1589,6 +1589,16 @@ function BuildLookupDataField(fieldSchema, updateObj, db) {
1589
1589
  else if (data && data.length > 0) {
1590
1590
  fldLookupData_1 = data[0];
1591
1591
  updateObj[alias_1] = fldLookupData_1;
1592
+ //** Below code is added by Shahzaib on 05/09/2022 to create SearchValue */
1593
+ var result = '';
1594
+ if (fieldSchema.LookupFields != undefined) {
1595
+ for (var j = 0; j < fieldSchema.LookupFields.length; j++) {
1596
+ if (fldLookupData_1[fieldSchema.LookupFields[j]] != undefined)
1597
+ result += fldLookupData_1[fieldSchema.LookupFields[j]].toString() + ' ';
1598
+ }
1599
+ }
1600
+ updateObj[searchAlias_1] = result === null || result === void 0 ? void 0 : result.trim();
1601
+ //** Ends here */
1592
1602
  }
1593
1603
  resolve();
1594
1604
  });
@@ -1604,12 +1614,16 @@ function BuildLookupDataField(fieldSchema, updateObj, db) {
1604
1614
  aggregateArry.push({ $project: { _id: 0, Key: '$Data.Key', Value: '$Data.Value', IsActive: '$Data.IsActive' } });
1605
1615
  aggregateArry.push({ $match: { 'Key': fldValue_1 } });
1606
1616
  db.collection('ListSchema').aggregate(aggregateArry).toArray(function (err, data) {
1617
+ var _a;
1607
1618
  if (err) {
1608
1619
  errorHandler(fldValue_1, err);
1609
1620
  }
1610
1621
  else if (data && data.length > 0) {
1611
1622
  fldLookupData_1 = data[0];
1612
1623
  updateObj[alias_1] = fldLookupData_1;
1624
+ //** Below code is added by Shahzaib on 05/09/2022 to create SearchValue */
1625
+ updateObj[searchAlias_1] = (_a = fldLookupData_1.Value) === null || _a === void 0 ? void 0 : _a.trim();
1626
+ //** Ends here */
1613
1627
  }
1614
1628
  resolve();
1615
1629
  });
@@ -1626,6 +1640,19 @@ function BuildLookupDataField(fieldSchema, updateObj, db) {
1626
1640
  else if (data && data.length > 0) {
1627
1641
  fldLookupData_1 = data;
1628
1642
  updateObj[alias_1] = fldLookupData_1;
1643
+ //** Below code is added by Shahzaib on 05/09/2022 to create SearchValue */
1644
+ var result = '';
1645
+ for (var i = 0; i < data.length; i++) {
1646
+ var lookupRecord = data[i];
1647
+ if (fieldSchema.LookupFields != undefined) {
1648
+ for (var j = 0; j < fieldSchema.LookupFields.length; j++) {
1649
+ if (lookupRecord[fieldSchema.LookupFields[j]] != undefined)
1650
+ result += lookupRecord[fieldSchema.LookupFields[j]].toString() + ' ';
1651
+ }
1652
+ }
1653
+ }
1654
+ updateObj[searchAlias_1] = result === null || result === void 0 ? void 0 : result.trim();
1655
+ //** Ends here */
1629
1656
  }
1630
1657
  resolve();
1631
1658
  });
@@ -1636,12 +1663,21 @@ function BuildLookupDataField(fieldSchema, updateObj, db) {
1636
1663
  aggregateArry.push({ $project: { _id: 0, Key: '$Data.Key', Value: '$Data.Value', IsActive: '$Data.IsActive' } });
1637
1664
  aggregateArry.push({ $match: { 'Key': { $in: fldValue_1 } } });
1638
1665
  db.collection('ListSchema').aggregate(aggregateArry).toArray(function (err, data) {
1666
+ var _a;
1639
1667
  if (err) {
1640
1668
  errorHandler(fldValue_1, err);
1641
1669
  }
1642
1670
  else if (data && data.length > 0) {
1643
1671
  fldLookupData_1 = data;
1644
1672
  updateObj[alias_1] = fldLookupData_1;
1673
+ //** Below code is added by Shahzaib on 05/09/2022 to create SearchValue */
1674
+ var result = '';
1675
+ for (var i = 0; i < data.length; i++) {
1676
+ var lookupRecord = data[i];
1677
+ result += ((_a = lookupRecord.Value) === null || _a === void 0 ? void 0 : _a.toString()) + ' ';
1678
+ }
1679
+ updateObj[searchAlias_1] = result === null || result === void 0 ? void 0 : result.trim();
1680
+ //** Ends here */
1645
1681
  }
1646
1682
  resolve();
1647
1683
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.294",
3
+ "version": "1.0.295",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {