@optimiser/common 1.0.445 → 1.0.447
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 +18 -11
- package/package.json +1 -1
package/dist/lib/utility.js
CHANGED
|
@@ -702,6 +702,9 @@ function SyncChildObjectData(pageData, objectID, db) {
|
|
|
702
702
|
_a.label = 13;
|
|
703
703
|
case 13:
|
|
704
704
|
SyncFieldInSameCollectionByObjectID(group.ChildObject, insertedChildID, db);
|
|
705
|
+
if (!group.ChildObjectField || group.ChildObjectField == "undefined") { // Error Log added to debug QPC-12786
|
|
706
|
+
console.error("IMPORTANT---------(QPC-12786)Error in SyncChildObjectData - ChildObjectField not found in \n objectName: ".concat(objectName, ", \n objectID: ").concat(objectID, ", \n group.ChildObject: ").concat(group.ChildObject, ", \n Company - ").concat(db.databaseName, ", \n PageName- ").concat(pageData.PageName, ", \n group: ").concat(JSON.stringify(group)));
|
|
707
|
+
}
|
|
705
708
|
_a.label = 14;
|
|
706
709
|
case 14:
|
|
707
710
|
i++;
|
|
@@ -4658,11 +4661,11 @@ exports.GetDayIndex = GetDayIndex;
|
|
|
4658
4661
|
function GetUserProfile(msp_d, db, mdb, next) {
|
|
4659
4662
|
var _a;
|
|
4660
4663
|
return __awaiter(this, void 0, void 0, function () {
|
|
4661
|
-
var userData, userProfile_1, error_5, objectIDs_1, modules_1, licenceDetail_1, companyLevelLicenceDetail, moduleList, _loop_17, i, error_6;
|
|
4664
|
+
var userData, userProfile_1, error_5, objectIDs_1, modules_1, licenceDetail_1, companyLevelLicenceAll, companylicenceDetail_1, companyLevelLicenceDetail, moduleList, _loop_17, i, error_6;
|
|
4662
4665
|
return __generator(this, function (_b) {
|
|
4663
4666
|
switch (_b.label) {
|
|
4664
4667
|
case 0:
|
|
4665
|
-
_b.trys.push([0,
|
|
4668
|
+
_b.trys.push([0, 12, , 13]);
|
|
4666
4669
|
return [4 /*yield*/, db.collection("User").findOne({ '_id': new mongodb_1.ObjectId(msp_d.ui), IsActive: true }, { projection: { 'LicenceDetail': 1, 'CompanyID': 1 } })];
|
|
4667
4670
|
case 1:
|
|
4668
4671
|
userData = _b.sent();
|
|
@@ -4702,7 +4705,7 @@ function GetUserProfile(msp_d, db, mdb, next) {
|
|
|
4702
4705
|
if (!(!userProfile_1 || userProfile_1.length <= 0)) return [3 /*break*/, 6];
|
|
4703
4706
|
return [2 /*return*/, { statusCode: 500, message: "User's profile data not found.", data: {} }];
|
|
4704
4707
|
case 6:
|
|
4705
|
-
if (!(userData.LicenceDetail && userData.LicenceDetail.length > 0)) return [3 /*break*/,
|
|
4708
|
+
if (!(userData.LicenceDetail && userData.LicenceDetail.length > 0)) return [3 /*break*/, 10];
|
|
4706
4709
|
objectIDs_1 = [];
|
|
4707
4710
|
userData.LicenceDetail.forEach(function (licenceDetail) {
|
|
4708
4711
|
if (licenceDetail.Status == "active")
|
|
@@ -4712,9 +4715,13 @@ function GetUserProfile(msp_d, db, mdb, next) {
|
|
|
4712
4715
|
return [4 /*yield*/, mdb.collection("Licences").find({ '_id': { $in: objectIDs_1 }, 'Status': 'active', 'IsActive': true }).toArray()];
|
|
4713
4716
|
case 7:
|
|
4714
4717
|
licenceDetail_1 = _b.sent();
|
|
4715
|
-
return [4 /*yield*/, mdb.collection("Licences").find({ "IsCompanyLevelLicence": true, "Status": "active", "IsActive": true }, { projection: { Modules: 1 } }).toArray()];
|
|
4718
|
+
return [4 /*yield*/, mdb.collection("Licences").find({ "IsCompanyLevelLicence": true, "Status": "active", "IsActive": true }, { projection: { Modules: 1, LicenceName: 1, LicenceType: 1 } }).toArray()];
|
|
4716
4719
|
case 8:
|
|
4717
|
-
|
|
4720
|
+
companyLevelLicenceAll = _b.sent();
|
|
4721
|
+
return [4 /*yield*/, mdb.collection("CompanyLicence").find({ 'CompanyID': userData.CompanyID, 'Status': 'active', 'IsActive': true }).toArray()];
|
|
4722
|
+
case 9:
|
|
4723
|
+
companylicenceDetail_1 = _b.sent();
|
|
4724
|
+
companyLevelLicenceDetail = companyLevelLicenceAll.filter(function (x) { return companylicenceDetail_1.some(function (y) { return x.LicenceName === y.LicenceName && x.LicenceType === y.LicenceType; }); });
|
|
4718
4725
|
if (companyLevelLicenceDetail && companyLevelLicenceDetail.length > 0) {
|
|
4719
4726
|
companyLevelLicenceDetail.map(function (x) {
|
|
4720
4727
|
var _a;
|
|
@@ -4751,15 +4758,15 @@ function GetUserProfile(msp_d, db, mdb, next) {
|
|
|
4751
4758
|
else {
|
|
4752
4759
|
return [2 /*return*/, { statusCode: 200, message: "Licence data is not found in Master database.", data: {} }];
|
|
4753
4760
|
}
|
|
4754
|
-
return [3 /*break*/,
|
|
4755
|
-
case
|
|
4756
|
-
case
|
|
4757
|
-
case
|
|
4761
|
+
return [3 /*break*/, 11];
|
|
4762
|
+
case 10: return [2 /*return*/, { statusCode: 200, message: "There is no licence assigned to this user, please contact your administrator.", data: {} }];
|
|
4763
|
+
case 11: return [3 /*break*/, 13];
|
|
4764
|
+
case 12:
|
|
4758
4765
|
error_6 = _b.sent();
|
|
4759
4766
|
console.error("Internal Error in GetUserProfile Utility function : ".concat(error_6));
|
|
4760
4767
|
next(error_6);
|
|
4761
|
-
return [3 /*break*/,
|
|
4762
|
-
case
|
|
4768
|
+
return [3 /*break*/, 13];
|
|
4769
|
+
case 13: return [2 /*return*/];
|
|
4763
4770
|
}
|
|
4764
4771
|
});
|
|
4765
4772
|
});
|