@optimiser/common 1.0.334 → 1.0.335

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.
@@ -3829,7 +3829,15 @@ function SyncUserLicenceConsumedCount(msp_d, db, dbMaster) {
3829
3829
  case 3:
3830
3830
  comLicenceInUserLicence = _a.sent();
3831
3831
  if (comLicenceInUserLicence && comLicenceInUserLicence.length) {
3832
- bulkLicenceOps = [];
3832
+ bulkLicenceOps = [{
3833
+ updateMany: {
3834
+ filter: { 'CompanyID': new mongodb_1.ObjectId(msp_d.ci), 'LicenceType': { $ne: 'Domain' }, Status: 'active', IsActive: true },
3835
+ update: [
3836
+ { $set: { 'NoOfLicenceConsumed': 0 } },
3837
+ { $set: { 'NoOfRemainingLicence': "$NoOfLicence" } }
3838
+ ]
3839
+ }
3840
+ }];
3833
3841
  for (u = 0; u < comLicenceInUserLicence.length; u++) {
3834
3842
  licenceID = comLicenceInUserLicence[u]._id['CompanyLicenceID'];
3835
3843
  licenceTotal = comLicenceInUserLicence[u].Total;
@@ -3845,9 +3853,7 @@ function SyncUserLicenceConsumedCount(msp_d, db, dbMaster) {
3845
3853
  });
3846
3854
  }
3847
3855
  }
3848
- if (bulkLicenceOps.length) {
3849
- dbMaster.collection('CompanyLicence').bulkWrite(bulkLicenceOps);
3850
- }
3856
+ dbMaster.collection('CompanyLicence').bulkWrite(bulkLicenceOps);
3851
3857
  }
3852
3858
  else {
3853
3859
  console.log('In company (' + msp_d.ci + '), copmany licence data not found in user licence while syncing user licence consumed count.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.334",
3
+ "version": "1.0.335",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {