@optimiser/common 1.0.309 → 1.0.311
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.d.ts +3 -1
- package/dist/lib/utility.js +106 -91
- package/package.json +1 -1
package/dist/lib/utility.d.ts
CHANGED
|
@@ -7,9 +7,11 @@ import { AnyObjectInterface, callBackInterface } from "../modals/utility.modal";
|
|
|
7
7
|
import { OPT_Request } from "../modals/connection.modal";
|
|
8
8
|
import { Redis } from "ioredis";
|
|
9
9
|
import 'moment-timezone';
|
|
10
|
+
import { integer } from "aws-sdk/clients/cloudfront";
|
|
10
11
|
declare function GetObjectByKeyValueFromList(list: AnyObjectInterface, key: string, val: any): any;
|
|
11
12
|
declare function IsEqualArrays(a: [any] | [], b: [any] | []): boolean;
|
|
12
13
|
declare function IsEqualValue(a: any, b: any): boolean;
|
|
14
|
+
declare function AddDaysToDate(date: any, days: integer): Date;
|
|
13
15
|
declare function CheckUserProfileField(pageData: AnyObjectInterface, profileData: AnyObjectInterface): void;
|
|
14
16
|
declare function GetPageFieldData(pageName: string, db: any, mdb: any, msp_d: any, next: NextFunction, callback: callBackInterface): void;
|
|
15
17
|
declare function GetPageObjectSchema(pageName: string, db: Db, next: NextFunction, callback: callBackInterface): void;
|
|
@@ -233,4 +235,4 @@ declare function GetMailFromString(fromUser: string): string;
|
|
|
233
235
|
* @returns string
|
|
234
236
|
*/
|
|
235
237
|
declare function InvitationMailReplyContent(fromUser: string, fromEmail: string): string;
|
|
236
|
-
export { CheckForWhiteListedDomain, ReturnJsonResponse, ConvertFileByteSize, GetObjectByKeyValueFromList, IsEqualArrays, IsEqualValue, CheckUserProfileField, GetPageFieldData, GetPageObjectSchema, GetFieldDetail, UpdateRecentViewObject, UpdateRecentViewFields, SyncChildObjectData, SyncParentObjectData, DeleteFieldInOtherCollection, SyncFieldInSameCollection, SyncFieldInSameCollectionByObjectID, SyncFieldInSameCollectionByObjectIDWithPromise, SyncFieldInOtherCollection, SyncUserInOtherCollection, BuildLookupDataField, CheckDataBeforeAdd, CheckDataBeforeUpdate, BuildGridFieldProjection, BuildFieldProjection, BuildLookupFieldProjection, FilterConditions, GirdHeaderFilters, FieldsGridHeaderFilters, AddLog, CheckFilterFieldsProjection, VerifyEmailPassword, GetMyTeamUsers, ExtractChildUsersTree, GetMaxKeyValueListSchema, VerifyAWSEmailConfig, GenerateId, SyncUserDetailsWithMasterDB, SignoutUserFromAllDevices, SignoutUsersWithPromise, SignoutMultipleUsersFromAllDevices, UserLicenseConsumeCalculate, sendMailWithUserAccount, GetEmailClientConfigs, GetCompanyEncryptionKey, ExecuteDynamicDMLQuery, ExecuteDynamicDQLQuery, GetUserProfilePermissions, MakeUserPasswordInvalid, ConvertJsonToXLXS, SendResetPasswordMail, SendMailToSupport, MailTemplateStructure, SendMailToCustomer, parseMSPCookie, GetIPDetailsFromReq, isEmptyObj, SyncListSchemaFieldInOtherCollection, UpdateTagCountAfterDelete, SyncTagCountAfterUpdate, ReactivateFieldInOtherCollection, SyncUserLicenceConsumedCount, BroadCastEventToAllCompanyUsers, CheckDataPermission, SyncCompanyLicenceInMasterCompanyAfterAdd, NextServiceDateForDashboard, CheckDateNotInPast, GetWeekDayByDayAndOccurance, GetInterValFromOccurance, GetWeekDayInfoInMonth, GetDayIndex, RemoveFieldsFromFilters, GetUserProfile, CheckPageAuthentication, ErrorHandlerForServices, CheckCaptcha, IsStringValue, ValidateSanitizeUserInput, ValidateUserInput, CreateBanquetingVATSettingsData, CheckReportFolderAccess, GetMailFromString, InvitationMailReplyContent };
|
|
238
|
+
export { CheckForWhiteListedDomain, ReturnJsonResponse, ConvertFileByteSize, GetObjectByKeyValueFromList, IsEqualArrays, IsEqualValue, CheckUserProfileField, GetPageFieldData, GetPageObjectSchema, GetFieldDetail, UpdateRecentViewObject, UpdateRecentViewFields, SyncChildObjectData, SyncParentObjectData, DeleteFieldInOtherCollection, SyncFieldInSameCollection, SyncFieldInSameCollectionByObjectID, SyncFieldInSameCollectionByObjectIDWithPromise, SyncFieldInOtherCollection, SyncUserInOtherCollection, BuildLookupDataField, CheckDataBeforeAdd, CheckDataBeforeUpdate, BuildGridFieldProjection, BuildFieldProjection, BuildLookupFieldProjection, FilterConditions, GirdHeaderFilters, FieldsGridHeaderFilters, AddLog, CheckFilterFieldsProjection, VerifyEmailPassword, GetMyTeamUsers, ExtractChildUsersTree, GetMaxKeyValueListSchema, VerifyAWSEmailConfig, GenerateId, SyncUserDetailsWithMasterDB, SignoutUserFromAllDevices, SignoutUsersWithPromise, SignoutMultipleUsersFromAllDevices, UserLicenseConsumeCalculate, sendMailWithUserAccount, GetEmailClientConfigs, GetCompanyEncryptionKey, ExecuteDynamicDMLQuery, ExecuteDynamicDQLQuery, GetUserProfilePermissions, MakeUserPasswordInvalid, ConvertJsonToXLXS, SendResetPasswordMail, SendMailToSupport, MailTemplateStructure, SendMailToCustomer, parseMSPCookie, GetIPDetailsFromReq, isEmptyObj, SyncListSchemaFieldInOtherCollection, UpdateTagCountAfterDelete, SyncTagCountAfterUpdate, ReactivateFieldInOtherCollection, SyncUserLicenceConsumedCount, BroadCastEventToAllCompanyUsers, CheckDataPermission, SyncCompanyLicenceInMasterCompanyAfterAdd, NextServiceDateForDashboard, CheckDateNotInPast, GetWeekDayByDayAndOccurance, GetInterValFromOccurance, GetWeekDayInfoInMonth, GetDayIndex, RemoveFieldsFromFilters, GetUserProfile, CheckPageAuthentication, ErrorHandlerForServices, CheckCaptcha, IsStringValue, ValidateSanitizeUserInput, ValidateUserInput, AddDaysToDate, CreateBanquetingVATSettingsData, CheckReportFolderAccess, GetMailFromString, InvitationMailReplyContent };
|
package/dist/lib/utility.js
CHANGED
|
@@ -80,7 +80,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
80
80
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
81
81
|
};
|
|
82
82
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
|
-
exports.InvitationMailReplyContent = exports.GetMailFromString = exports.CheckReportFolderAccess = exports.CreateBanquetingVATSettingsData = exports.ValidateUserInput = exports.ValidateSanitizeUserInput = exports.IsStringValue = exports.CheckCaptcha = exports.ErrorHandlerForServices = exports.CheckPageAuthentication = exports.GetUserProfile = exports.RemoveFieldsFromFilters = exports.GetDayIndex = exports.GetWeekDayInfoInMonth = exports.GetInterValFromOccurance = exports.GetWeekDayByDayAndOccurance = exports.CheckDateNotInPast = exports.NextServiceDateForDashboard = exports.SyncCompanyLicenceInMasterCompanyAfterAdd = exports.CheckDataPermission = exports.BroadCastEventToAllCompanyUsers = exports.SyncUserLicenceConsumedCount = exports.ReactivateFieldInOtherCollection = exports.SyncTagCountAfterUpdate = exports.UpdateTagCountAfterDelete = exports.SyncListSchemaFieldInOtherCollection = exports.isEmptyObj = exports.GetIPDetailsFromReq = exports.parseMSPCookie = exports.SendMailToCustomer = exports.MailTemplateStructure = exports.SendMailToSupport = exports.SendResetPasswordMail = exports.ConvertJsonToXLXS = exports.MakeUserPasswordInvalid = exports.GetUserProfilePermissions = exports.ExecuteDynamicDQLQuery = exports.ExecuteDynamicDMLQuery = exports.GetCompanyEncryptionKey = exports.GetEmailClientConfigs = exports.sendMailWithUserAccount = exports.UserLicenseConsumeCalculate = exports.SignoutMultipleUsersFromAllDevices = exports.SignoutUsersWithPromise = exports.SignoutUserFromAllDevices = exports.SyncUserDetailsWithMasterDB = exports.GenerateId = exports.VerifyAWSEmailConfig = exports.GetMaxKeyValueListSchema = exports.ExtractChildUsersTree = exports.GetMyTeamUsers = exports.VerifyEmailPassword = exports.CheckFilterFieldsProjection = exports.AddLog = exports.FieldsGridHeaderFilters = exports.GirdHeaderFilters = exports.FilterConditions = exports.BuildLookupFieldProjection = exports.BuildFieldProjection = exports.BuildGridFieldProjection = exports.CheckDataBeforeUpdate = exports.CheckDataBeforeAdd = exports.BuildLookupDataField = exports.SyncUserInOtherCollection = exports.SyncFieldInOtherCollection = exports.SyncFieldInSameCollectionByObjectIDWithPromise = exports.SyncFieldInSameCollectionByObjectID = exports.SyncFieldInSameCollection = exports.DeleteFieldInOtherCollection = exports.SyncParentObjectData = exports.SyncChildObjectData = exports.UpdateRecentViewFields = exports.UpdateRecentViewObject = exports.GetFieldDetail = exports.GetPageObjectSchema = exports.GetPageFieldData = exports.CheckUserProfileField = exports.IsEqualValue = exports.IsEqualArrays = exports.GetObjectByKeyValueFromList = exports.ConvertFileByteSize = exports.ReturnJsonResponse = exports.CheckForWhiteListedDomain = void 0;
|
|
83
|
+
exports.InvitationMailReplyContent = exports.GetMailFromString = exports.CheckReportFolderAccess = exports.CreateBanquetingVATSettingsData = exports.AddDaysToDate = exports.ValidateUserInput = exports.ValidateSanitizeUserInput = exports.IsStringValue = exports.CheckCaptcha = exports.ErrorHandlerForServices = exports.CheckPageAuthentication = exports.GetUserProfile = exports.RemoveFieldsFromFilters = exports.GetDayIndex = exports.GetWeekDayInfoInMonth = exports.GetInterValFromOccurance = exports.GetWeekDayByDayAndOccurance = exports.CheckDateNotInPast = exports.NextServiceDateForDashboard = exports.SyncCompanyLicenceInMasterCompanyAfterAdd = exports.CheckDataPermission = exports.BroadCastEventToAllCompanyUsers = exports.SyncUserLicenceConsumedCount = exports.ReactivateFieldInOtherCollection = exports.SyncTagCountAfterUpdate = exports.UpdateTagCountAfterDelete = exports.SyncListSchemaFieldInOtherCollection = exports.isEmptyObj = exports.GetIPDetailsFromReq = exports.parseMSPCookie = exports.SendMailToCustomer = exports.MailTemplateStructure = exports.SendMailToSupport = exports.SendResetPasswordMail = exports.ConvertJsonToXLXS = exports.MakeUserPasswordInvalid = exports.GetUserProfilePermissions = exports.ExecuteDynamicDQLQuery = exports.ExecuteDynamicDMLQuery = exports.GetCompanyEncryptionKey = exports.GetEmailClientConfigs = exports.sendMailWithUserAccount = exports.UserLicenseConsumeCalculate = exports.SignoutMultipleUsersFromAllDevices = exports.SignoutUsersWithPromise = exports.SignoutUserFromAllDevices = exports.SyncUserDetailsWithMasterDB = exports.GenerateId = exports.VerifyAWSEmailConfig = exports.GetMaxKeyValueListSchema = exports.ExtractChildUsersTree = exports.GetMyTeamUsers = exports.VerifyEmailPassword = exports.CheckFilterFieldsProjection = exports.AddLog = exports.FieldsGridHeaderFilters = exports.GirdHeaderFilters = exports.FilterConditions = exports.BuildLookupFieldProjection = exports.BuildFieldProjection = exports.BuildGridFieldProjection = exports.CheckDataBeforeUpdate = exports.CheckDataBeforeAdd = exports.BuildLookupDataField = exports.SyncUserInOtherCollection = exports.SyncFieldInOtherCollection = exports.SyncFieldInSameCollectionByObjectIDWithPromise = exports.SyncFieldInSameCollectionByObjectID = exports.SyncFieldInSameCollection = exports.DeleteFieldInOtherCollection = exports.SyncParentObjectData = exports.SyncChildObjectData = exports.UpdateRecentViewFields = exports.UpdateRecentViewObject = exports.GetFieldDetail = exports.GetPageObjectSchema = exports.GetPageFieldData = exports.CheckUserProfileField = exports.IsEqualValue = exports.IsEqualArrays = exports.GetObjectByKeyValueFromList = exports.ConvertFileByteSize = exports.ReturnJsonResponse = exports.CheckForWhiteListedDomain = void 0;
|
|
84
84
|
var moment_1 = __importDefault(require("moment"));
|
|
85
85
|
var nodemailer_1 = __importDefault(require("nodemailer"));
|
|
86
86
|
var mongodb_1 = require("mongodb");
|
|
@@ -142,6 +142,12 @@ function IsEqualValue(a, b) {
|
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
144
|
exports.IsEqualValue = IsEqualValue;
|
|
145
|
+
function AddDaysToDate(date, days) {
|
|
146
|
+
var result = new Date(date);
|
|
147
|
+
result.setDate(result.getDate() + days);
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
exports.AddDaysToDate = AddDaysToDate;
|
|
145
151
|
function CheckUserProfileField(pageData, profileData) {
|
|
146
152
|
if (profileData && profileData.Fields) {
|
|
147
153
|
var _loop_1 = function (i) {
|
|
@@ -1863,88 +1869,97 @@ function BuildGridFieldProjection(project, field, group) {
|
|
|
1863
1869
|
var searchConcatArry = [];
|
|
1864
1870
|
switch (field.Schema.UIDataType) {
|
|
1865
1871
|
// below code was added by Shahzaib on 05/09/2022
|
|
1866
|
-
case "lookup":
|
|
1867
|
-
case "multilookup":
|
|
1868
|
-
case "dropdown":
|
|
1869
|
-
case "multiselect":
|
|
1870
|
-
alias = fldName + constants_1.default.LookupAlias;
|
|
1871
|
-
project[fldName] = 1;
|
|
1872
|
-
project[alias] = 1;
|
|
1873
|
-
project[searchAlias] = 1;
|
|
1874
|
-
break;
|
|
1875
|
-
// Below code was commented by Shahzaib on 05/09/2022, searchAlias was added instead of it.
|
|
1876
1872
|
// case "lookup":
|
|
1877
|
-
// alias = fldName + constants.LookupAlias;
|
|
1878
|
-
// project[fldName] = 1;
|
|
1879
|
-
// project[alias] = 1;
|
|
1880
|
-
// for (let i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1881
|
-
// if (field.Schema.ExcludeLookupFieldsOnSearch && field.Schema.ExcludeLookupFieldsOnSearch.filter((x: AnyObjectInterface) => x == field.Schema.LookupFields[i]).length != 0) {
|
|
1882
|
-
// continue;
|
|
1883
|
-
// }
|
|
1884
|
-
// // searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], ""] });
|
|
1885
|
-
// // added by Shahzaib, make int to string and concat
|
|
1886
|
-
// searchConcatArry.push({ "$ifNull": [{$toString : '$' + alias + '.' + field.Schema.LookupFields[i]}, ""] });
|
|
1887
|
-
// if (i < field.Schema.LookupFields.length - 1) {
|
|
1888
|
-
// searchConcatArry.push(" ");
|
|
1889
|
-
// }
|
|
1890
|
-
// };
|
|
1891
|
-
// project[fldName + '_SearchValue'] = { $concat: searchConcatArry };
|
|
1892
|
-
// break;
|
|
1893
1873
|
// case "multilookup":
|
|
1894
|
-
// alias = fldName + constants.LookupAlias;
|
|
1895
|
-
// project[fldName] = 1;
|
|
1896
|
-
// project[alias] = 1;
|
|
1897
|
-
// for (let i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1898
|
-
// searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], [" "]] });
|
|
1899
|
-
// if (i < field.Schema.LookupFields.length - 1) {
|
|
1900
|
-
// searchConcatArry.push([" "]);
|
|
1901
|
-
// }
|
|
1902
|
-
// };
|
|
1903
|
-
// //project[fldName + '_SearchValue'] = { $concatArrays: searchConcatArry };
|
|
1904
|
-
// project[fldName + '_SearchValue'] = {
|
|
1905
|
-
// $reduce: {
|
|
1906
|
-
// input: { $concatArrays: searchConcatArry },
|
|
1907
|
-
// initialValue: "",
|
|
1908
|
-
// //in: { $concat: ["$$value", "$$this"] } // Commented by and below line was added by Shahzaib, make int to string
|
|
1909
|
-
// in: { $concat: ["$$value", { $toString : "$$this" }] }
|
|
1910
|
-
// }
|
|
1911
|
-
// };
|
|
1912
|
-
// break;
|
|
1913
1874
|
// case "dropdown":
|
|
1914
|
-
// alias = fldName + constants.LookupAlias;
|
|
1915
|
-
// project[fldName] = 1;
|
|
1916
|
-
// project[alias] = 1;
|
|
1917
|
-
// if (field.Schema.LookupObject) {
|
|
1918
|
-
// for (let i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1919
|
-
// //searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], ""] });
|
|
1920
|
-
// // added by Mohan, make int to string and concat
|
|
1921
|
-
// searchConcatArry.push({ "$ifNull": [{$toString : '$' + alias + '.' + field.Schema.LookupFields[i]}, ""] });
|
|
1922
|
-
// if (i < field.Schema.LookupFields.length - 1) {
|
|
1923
|
-
// searchConcatArry.push(" ");
|
|
1924
|
-
// }
|
|
1925
|
-
// };
|
|
1926
|
-
// project[fldName + '_SearchValue'] = { $concat: searchConcatArry };
|
|
1927
|
-
// } else {
|
|
1928
|
-
// project[fldName + '_SearchValue'] = '$' + alias + '.Value';
|
|
1929
|
-
// }
|
|
1930
|
-
// break;
|
|
1931
1875
|
// case "multiselect":
|
|
1932
1876
|
// alias = fldName + constants.LookupAlias;
|
|
1933
1877
|
// project[fldName] = 1;
|
|
1934
1878
|
// project[alias] = 1;
|
|
1935
|
-
//
|
|
1936
|
-
// for (let i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1937
|
-
// searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], [" "] ] });
|
|
1938
|
-
// if (i < field.Schema.LookupFields.length - 1) {
|
|
1939
|
-
// searchConcatArry.push([" "]);
|
|
1940
|
-
// }
|
|
1941
|
-
// };
|
|
1942
|
-
// project[fldName + '_SearchValue'] = { $concatArrays: searchConcatArry };
|
|
1943
|
-
// } else {
|
|
1944
|
-
// searchConcatArry.push('$' + alias + '.Value');
|
|
1945
|
-
// project[fldName + '_SearchValue'] = { $concatArrays: searchConcatArry };
|
|
1946
|
-
// }
|
|
1879
|
+
// project[searchAlias] = 1;
|
|
1947
1880
|
// break;
|
|
1881
|
+
// Below code was commented by Shahzaib on 05/09/2022, searchAlias was added instead of it.
|
|
1882
|
+
case "lookup":
|
|
1883
|
+
alias = fldName + constants_1.default.LookupAlias;
|
|
1884
|
+
project[fldName] = 1;
|
|
1885
|
+
project[alias] = 1;
|
|
1886
|
+
var _loop_13 = function (i) {
|
|
1887
|
+
if (field.Schema.ExcludeLookupFieldsOnSearch && field.Schema.ExcludeLookupFieldsOnSearch.filter(function (x) { return x == field.Schema.LookupFields[i]; }).length != 0) {
|
|
1888
|
+
return "continue";
|
|
1889
|
+
}
|
|
1890
|
+
// searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], ""] });
|
|
1891
|
+
// added by Shahzaib, make int to string and concat
|
|
1892
|
+
searchConcatArry.push({ "$ifNull": [{ $toString: '$' + alias + '.' + field.Schema.LookupFields[i] }, ""] });
|
|
1893
|
+
if (i < field.Schema.LookupFields.length - 1) {
|
|
1894
|
+
searchConcatArry.push(" ");
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
for (var i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1898
|
+
_loop_13(i);
|
|
1899
|
+
}
|
|
1900
|
+
;
|
|
1901
|
+
project[fldName + '_SearchValue'] = { $concat: searchConcatArry };
|
|
1902
|
+
break;
|
|
1903
|
+
case "multilookup":
|
|
1904
|
+
alias = fldName + constants_1.default.LookupAlias;
|
|
1905
|
+
project[fldName] = 1;
|
|
1906
|
+
project[alias] = 1;
|
|
1907
|
+
for (var i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1908
|
+
searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], [" "]] });
|
|
1909
|
+
if (i < field.Schema.LookupFields.length - 1) {
|
|
1910
|
+
searchConcatArry.push([" "]);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
;
|
|
1914
|
+
//project[fldName + '_SearchValue'] = { $concatArrays: searchConcatArry };
|
|
1915
|
+
project[fldName + '_SearchValue'] = {
|
|
1916
|
+
$reduce: {
|
|
1917
|
+
input: { $concatArrays: searchConcatArry },
|
|
1918
|
+
initialValue: "",
|
|
1919
|
+
//in: { $concat: ["$$value", "$$this"] } // Commented by and below line was added by Shahzaib, make int to string
|
|
1920
|
+
in: { $concat: ["$$value", { $toString: "$$this" }] }
|
|
1921
|
+
}
|
|
1922
|
+
};
|
|
1923
|
+
break;
|
|
1924
|
+
case "dropdown":
|
|
1925
|
+
alias = fldName + constants_1.default.LookupAlias;
|
|
1926
|
+
project[fldName] = 1;
|
|
1927
|
+
project[alias] = 1;
|
|
1928
|
+
if (field.Schema.LookupObject) {
|
|
1929
|
+
for (var i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1930
|
+
//searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], ""] });
|
|
1931
|
+
// added by Mohan, make int to string and concat
|
|
1932
|
+
searchConcatArry.push({ "$ifNull": [{ $toString: '$' + alias + '.' + field.Schema.LookupFields[i] }, ""] });
|
|
1933
|
+
if (i < field.Schema.LookupFields.length - 1) {
|
|
1934
|
+
searchConcatArry.push(" ");
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
;
|
|
1938
|
+
project[fldName + '_SearchValue'] = { $concat: searchConcatArry };
|
|
1939
|
+
}
|
|
1940
|
+
else {
|
|
1941
|
+
project[fldName + '_SearchValue'] = '$' + alias + '.Value';
|
|
1942
|
+
}
|
|
1943
|
+
break;
|
|
1944
|
+
case "multiselect":
|
|
1945
|
+
alias = fldName + constants_1.default.LookupAlias;
|
|
1946
|
+
project[fldName] = 1;
|
|
1947
|
+
project[alias] = 1;
|
|
1948
|
+
if (field.Schema.LookupObject) {
|
|
1949
|
+
for (var i = 0; i < field.Schema.LookupFields.length; i++) {
|
|
1950
|
+
searchConcatArry.push({ "$ifNull": ['$' + alias + '.' + field.Schema.LookupFields[i], [" "]] });
|
|
1951
|
+
if (i < field.Schema.LookupFields.length - 1) {
|
|
1952
|
+
searchConcatArry.push([" "]);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
;
|
|
1956
|
+
project[fldName + '_SearchValue'] = { $concatArrays: searchConcatArry };
|
|
1957
|
+
}
|
|
1958
|
+
else {
|
|
1959
|
+
searchConcatArry.push('$' + alias + '.Value');
|
|
1960
|
+
project[fldName + '_SearchValue'] = { $concatArrays: searchConcatArry };
|
|
1961
|
+
}
|
|
1962
|
+
break;
|
|
1948
1963
|
case "file":
|
|
1949
1964
|
case "image":
|
|
1950
1965
|
alias = fldName + constants_1.default.LookupAlias;
|
|
@@ -2129,7 +2144,7 @@ function FilterConditions(condition, match, fields) {
|
|
|
2129
2144
|
match.$or = new Array();
|
|
2130
2145
|
sets = match.$or;
|
|
2131
2146
|
}
|
|
2132
|
-
var
|
|
2147
|
+
var _loop_14 = function (i) {
|
|
2133
2148
|
var _a, _b, _c;
|
|
2134
2149
|
var obj = condition.Filters[i];
|
|
2135
2150
|
if (obj.Type == "Child") {
|
|
@@ -2313,7 +2328,7 @@ function FilterConditions(condition, match, fields) {
|
|
|
2313
2328
|
}
|
|
2314
2329
|
};
|
|
2315
2330
|
for (var i = 0; i < condition.Filters.length; i++) {
|
|
2316
|
-
|
|
2331
|
+
_loop_14(i);
|
|
2317
2332
|
}
|
|
2318
2333
|
}
|
|
2319
2334
|
}
|
|
@@ -2321,7 +2336,7 @@ exports.FilterConditions = FilterConditions;
|
|
|
2321
2336
|
function GirdHeaderFilters(filters, fields) {
|
|
2322
2337
|
try {
|
|
2323
2338
|
var sets = [];
|
|
2324
|
-
var
|
|
2339
|
+
var _loop_15 = function (i) {
|
|
2325
2340
|
var obj = filters[i];
|
|
2326
2341
|
var field = fields.find(function (x) { return x.UniqueID == obj.Name; });
|
|
2327
2342
|
if (field) {
|
|
@@ -2374,7 +2389,7 @@ function GirdHeaderFilters(filters, fields) {
|
|
|
2374
2389
|
}
|
|
2375
2390
|
};
|
|
2376
2391
|
for (var i = 0; i < filters.length; i++) {
|
|
2377
|
-
|
|
2392
|
+
_loop_15(i);
|
|
2378
2393
|
}
|
|
2379
2394
|
return { '$and': sets };
|
|
2380
2395
|
}
|
|
@@ -2386,7 +2401,7 @@ exports.GirdHeaderFilters = GirdHeaderFilters;
|
|
|
2386
2401
|
function FieldsGridHeaderFilters(filters, fields) {
|
|
2387
2402
|
var sets = [];
|
|
2388
2403
|
var lookupFieldsSets = [];
|
|
2389
|
-
var
|
|
2404
|
+
var _loop_16 = function (i) {
|
|
2390
2405
|
var _a;
|
|
2391
2406
|
var obj = filters[i];
|
|
2392
2407
|
var field = fields.find(function (x) { return x.UniqueID == obj.Name; });
|
|
@@ -2430,7 +2445,7 @@ function FieldsGridHeaderFilters(filters, fields) {
|
|
|
2430
2445
|
}
|
|
2431
2446
|
};
|
|
2432
2447
|
for (var i = 0; i < filters.length; i++) {
|
|
2433
|
-
|
|
2448
|
+
_loop_16(i);
|
|
2434
2449
|
}
|
|
2435
2450
|
return { '$and': sets, 'lookupConditions': lookupFieldsSets };
|
|
2436
2451
|
}
|
|
@@ -2468,7 +2483,7 @@ function AddLog(req, objectName, logAction, objLogProp, db, next) {
|
|
|
2468
2483
|
exports.AddLog = AddLog;
|
|
2469
2484
|
function CheckFilterFieldsProjection(condition, fields, pageData, project) {
|
|
2470
2485
|
if (condition != undefined && condition.Filters.length > 0) {
|
|
2471
|
-
var
|
|
2486
|
+
var _loop_17 = function (i) {
|
|
2472
2487
|
var objFilter = condition.Filters[i];
|
|
2473
2488
|
if (objFilter.Type == "Child") {
|
|
2474
2489
|
CheckFilterFieldsProjection(objFilter, fields, pageData, project);
|
|
@@ -2486,7 +2501,7 @@ function CheckFilterFieldsProjection(condition, fields, pageData, project) {
|
|
|
2486
2501
|
}
|
|
2487
2502
|
};
|
|
2488
2503
|
for (var i = 0; i < condition.Filters.length; i++) {
|
|
2489
|
-
|
|
2504
|
+
_loop_17(i);
|
|
2490
2505
|
}
|
|
2491
2506
|
}
|
|
2492
2507
|
}
|
|
@@ -4163,7 +4178,7 @@ exports.GetDayIndex = GetDayIndex;
|
|
|
4163
4178
|
function GetUserProfile(msp_d, db, mdb, next) {
|
|
4164
4179
|
var _a;
|
|
4165
4180
|
return __awaiter(this, void 0, void 0, function () {
|
|
4166
|
-
var userData, userProfile_1, error_3, objectIDs_1, modules_1, licenceDetail, companylicenceDetail, receptionLicense, moduleList,
|
|
4181
|
+
var userData, userProfile_1, error_3, objectIDs_1, modules_1, licenceDetail, companylicenceDetail, receptionLicense, moduleList, _loop_18, i, error_4;
|
|
4167
4182
|
return __generator(this, function (_b) {
|
|
4168
4183
|
switch (_b.label) {
|
|
4169
4184
|
case 0:
|
|
@@ -4242,14 +4257,14 @@ function GetUserProfile(msp_d, db, mdb, next) {
|
|
|
4242
4257
|
moduleList = userProfile_1[0].ModuleList;
|
|
4243
4258
|
userProfile_1[0].HasControlPanelAccess = [];
|
|
4244
4259
|
if (userProfile_1[0].Permissions) {
|
|
4245
|
-
|
|
4260
|
+
_loop_18 = function (i) {
|
|
4246
4261
|
userProfile_1[0].Permissions[i].ModuleData = moduleList.find(function (x) { return x._id == userProfile_1[0].Permissions[i].ModuleID; });
|
|
4247
4262
|
if ((_a = userProfile_1[0].Permissions[i].Operations) === null || _a === void 0 ? void 0 : _a.includes("Control Panel")) {
|
|
4248
4263
|
userProfile_1[0].HasControlPanelAccess.push(userProfile_1[0].Permissions[i].ModuleID);
|
|
4249
4264
|
}
|
|
4250
4265
|
};
|
|
4251
4266
|
for (i = 0; i < userProfile_1[0].Permissions.length; i++) {
|
|
4252
|
-
|
|
4267
|
+
_loop_18(i);
|
|
4253
4268
|
}
|
|
4254
4269
|
}
|
|
4255
4270
|
if (moduleList.length == 0) {
|
|
@@ -4546,7 +4561,7 @@ function IsAnotherObjectField(pageData, fieldName) {
|
|
|
4546
4561
|
*/
|
|
4547
4562
|
function ValidateUserInput(options) {
|
|
4548
4563
|
return __awaiter(this, void 0, void 0, function () {
|
|
4549
|
-
var inputFields, pageData, documentID, db, action, objectSchema, objectName, pageFields, schemaFields, inputField, msg,
|
|
4564
|
+
var inputFields, pageData, documentID, db, action, objectSchema, objectName, pageFields, schemaFields, inputField, msg, _loop_19, _i, inputField_1, name_1, state_1, _loop_20, isValid, validateResp, _a, pageFields_1, pageField, state_2, countryData, err_3;
|
|
4550
4565
|
return __generator(this, function (_b) {
|
|
4551
4566
|
switch (_b.label) {
|
|
4552
4567
|
case 0:
|
|
@@ -4567,7 +4582,7 @@ function ValidateUserInput(options) {
|
|
|
4567
4582
|
inputField = Object.keys(inputFields);
|
|
4568
4583
|
msg = '';
|
|
4569
4584
|
if (inputField && inputField.length) {
|
|
4570
|
-
|
|
4585
|
+
_loop_19 = function (name_1) {
|
|
4571
4586
|
var field = pageFields.find(function (x) { return x.Name == name_1; });
|
|
4572
4587
|
if (field == undefined && !IsSystemField(objectName, name_1)) {
|
|
4573
4588
|
msg = name_1 + " is not valid field!";
|
|
@@ -4576,12 +4591,12 @@ function ValidateUserInput(options) {
|
|
|
4576
4591
|
};
|
|
4577
4592
|
for (_i = 0, inputField_1 = inputField; _i < inputField_1.length; _i++) {
|
|
4578
4593
|
name_1 = inputField_1[_i];
|
|
4579
|
-
state_1 =
|
|
4594
|
+
state_1 = _loop_19(name_1);
|
|
4580
4595
|
if (state_1 === "break")
|
|
4581
4596
|
break;
|
|
4582
4597
|
}
|
|
4583
4598
|
}
|
|
4584
|
-
|
|
4599
|
+
_loop_20 = function (pageField) {
|
|
4585
4600
|
var fieldName, fieldData, field, searchQuery, result, _a, filter, searchObj, result, searchObj, totalRecord, _b, schemaData, result, searchObj, result, schemaData, result, searchObj, totalRecord, regexpression, phone, files, _i, fieldData_1, obj, searchObj, totalRecord, searchObj, result, _c, fieldData_2, obj;
|
|
4586
4601
|
return __generator(this, function (_d) {
|
|
4587
4602
|
switch (_d.label) {
|
|
@@ -4957,7 +4972,7 @@ function ValidateUserInput(options) {
|
|
|
4957
4972
|
case 1:
|
|
4958
4973
|
if (!(_a < pageFields_1.length)) return [3 /*break*/, 4];
|
|
4959
4974
|
pageField = pageFields_1[_a];
|
|
4960
|
-
return [5 /*yield**/,
|
|
4975
|
+
return [5 /*yield**/, _loop_20(pageField)];
|
|
4961
4976
|
case 2:
|
|
4962
4977
|
state_2 = _b.sent();
|
|
4963
4978
|
if (state_2 === "break")
|