@getjones/test-infra 2.9.7 → 2.9.8
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/package.json +1 -1
- package/src/common/commonFlows/records/records.js +38 -8
- package/src/common/utils/timeUtils.js +25 -1
- package/src/defaults/configs/polices.js +2 -6
- package/src/saas/internal-api/accounts/utils/utils.js +12 -4
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +11 -2
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +6 -1
- package/src/saas/internal-api/contractors/api/contractors.api.js +9 -1
- package/src/saas/internal-api/contractors/api/contractors.service.js +6 -1
- package/src/saas/internal-api/requirements/models/policy.model.js +0 -1
- package/src/saas/internal-api/users/api/users.api.js +1 -6
- package/src/saas/internal-api/users/api/users.service.js +2 -31
- package/src/saas/internal-api/users/models/users.model.js +1 -11
- package/src/saas/internal-api/users/utils/util.js +1 -20
- package/src/common/utils/configsUtil.js +0 -22
- package/src/resources/virusFile.pdf +0 -0
package/package.json
CHANGED
|
@@ -4,14 +4,15 @@ const threadScheduler = require('../../../saas/internal-api/thread-scheduler/run
|
|
|
4
4
|
const timeUtils = require('../../utils/timeUtils');
|
|
5
5
|
const httpResponseStatusCodes = require('../../../common/httpResponseStatusCodes.json');
|
|
6
6
|
const contractors = require('../../../saas/internal-api/contractors');
|
|
7
|
+
const compliance = require('../../../saas/internal-api/compliance');
|
|
7
8
|
|
|
8
9
|
const makeRecordNotResponsive = async function(recordId, context, { isTenant } = {}) {
|
|
9
|
-
const
|
|
10
|
-
timeUtils.
|
|
11
|
-
timeUtils.
|
|
10
|
+
const offsetInDaysList = isTenant ?
|
|
11
|
+
timeUtils.getInviteActionOffsetInDaysForNotResponsiveTenant() :
|
|
12
|
+
timeUtils.getInviteActionOffsetInDaysForNotResponsiveVendor();
|
|
12
13
|
|
|
13
|
-
for (const
|
|
14
|
-
await
|
|
14
|
+
for (const offsetInDays of offsetInDaysList) {
|
|
15
|
+
await updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
|
|
@@ -20,13 +21,41 @@ const updateInviteDate = async function(recordId, inviteDate, context) {
|
|
|
20
21
|
const updateResponse = await contractors.services.updateInviteDate(recordId, inviteDate, context);
|
|
21
22
|
|
|
22
23
|
if (updateResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
23
|
-
throw new Error(`
|
|
24
|
+
throw new Error(`Failed to update record invite date\n${updateResponse}`);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
27
28
|
|
|
28
29
|
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
29
|
-
throw new Error(`
|
|
30
|
+
throw new Error(`Failed to run thread scheduler\n${threadSchedulerResponse}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const updateLastInviteActionDate = async function(recordId, offsetInDays, context) {
|
|
37
|
+
await timeUtils.waitFor(1).seconds;
|
|
38
|
+
/*
|
|
39
|
+
To run the reminders mails successfully we must first update the compliance audit actions date,
|
|
40
|
+
Since the thread scheduler will trigger the logic of the reminders mails
|
|
41
|
+
only if last invite action date will be equal or after compliance audit actions date
|
|
42
|
+
*/
|
|
43
|
+
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId, offsetInDays, context);
|
|
44
|
+
|
|
45
|
+
if (updateComplianceAuditResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
46
|
+
throw new Error(`Failed to update compliance audit date\n${updateComplianceAuditResponse}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
50
|
+
|
|
51
|
+
if (updateLastInviteActionResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
52
|
+
throw new Error(`Failed to update record invite date\n${updateLastInviteActionResponse}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
56
|
+
|
|
57
|
+
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
58
|
+
throw new Error(`Failed to run thread scheduler\n${threadSchedulerResponse}`);
|
|
30
59
|
}
|
|
31
60
|
|
|
32
61
|
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
@@ -68,5 +97,6 @@ module.exports = {
|
|
|
68
97
|
runOverAllRenewalDatesForRecord,
|
|
69
98
|
updateInviteDate,
|
|
70
99
|
updatePolicyExpiryDateForRecord,
|
|
71
|
-
getHistoryEvents
|
|
100
|
+
getHistoryEvents,
|
|
101
|
+
updateLastInviteActionDate
|
|
72
102
|
};
|
|
@@ -24,6 +24,14 @@ const peroids = {
|
|
|
24
24
|
years: 'years'
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const inviteActionDateOffset = {
|
|
28
|
+
twoDays: 2,
|
|
29
|
+
threeDays: 3,
|
|
30
|
+
fiveDays: 5,
|
|
31
|
+
tenDays: 10,
|
|
32
|
+
fifteenDays: 15
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
const getOneYearAgoDate = format => moment().utc().subtract(1, peroids.years).format(format || formats.threadScheduler);
|
|
28
36
|
const getTwoHundredDaysAgoDate = format => moment().utc().subtract(200, peroids.days).format(format || formats.threadScheduler);
|
|
29
37
|
const getSixMonthAgoDate = format => moment().utc().subtract(6, peroids.months).format(format || formats.threadScheduler);
|
|
@@ -86,6 +94,10 @@ const getInvitationDatesForNotResponsiveVendor = function() {
|
|
|
86
94
|
return [twoDaysAgoUtc, fiveDaysAgoUtc, eightDaysAgoUtc];
|
|
87
95
|
};
|
|
88
96
|
|
|
97
|
+
const getInviteActionOffsetInDaysForNotResponsiveVendor = function() {
|
|
98
|
+
return [inviteActionDateOffset.twoDays, inviteActionDateOffset.threeDays, inviteActionDateOffset.threeDays];
|
|
99
|
+
};
|
|
100
|
+
|
|
89
101
|
const getInvitationDatesForNotResponsiveTenant = function() {
|
|
90
102
|
const fiveDaysAgoUtc = getFiveDaysAgoDate();
|
|
91
103
|
const tenDaysAgoUtc = getTenDaysAgoDate();
|
|
@@ -94,6 +106,10 @@ const getInvitationDatesForNotResponsiveTenant = function() {
|
|
|
94
106
|
return [fiveDaysAgoUtc, tenDaysAgoUtc, fifteenDaysAgoUtc];
|
|
95
107
|
};
|
|
96
108
|
|
|
109
|
+
const getInviteActionOffsetInDaysForNotResponsiveTenant = function() {
|
|
110
|
+
return [inviteActionDateOffset.fiveDays, inviteActionDateOffset.fiveDays, inviteActionDateOffset.fiveDays];
|
|
111
|
+
};
|
|
112
|
+
|
|
97
113
|
const isDateAfterOther = (date, other) => {
|
|
98
114
|
return moment(date).isAfter(other);
|
|
99
115
|
};
|
|
@@ -115,6 +131,10 @@ const convertDateToLongInt = value => {
|
|
|
115
131
|
return Date.parse(value);
|
|
116
132
|
};
|
|
117
133
|
|
|
134
|
+
const convertDateStringFormatToISOString = dateStringFormat => {
|
|
135
|
+
return new Date(dateStringFormat).toISOString();
|
|
136
|
+
};
|
|
137
|
+
|
|
118
138
|
module.exports = {
|
|
119
139
|
formats,
|
|
120
140
|
getOneYearAgoDate,
|
|
@@ -136,7 +156,9 @@ module.exports = {
|
|
|
136
156
|
getDateinTwentyNineDays,
|
|
137
157
|
getDateInTwoMonths,
|
|
138
158
|
getInvitationDatesForNotResponsiveVendor,
|
|
159
|
+
getInviteActionOffsetInDaysForNotResponsiveVendor,
|
|
139
160
|
getInvitationDatesForNotResponsiveTenant,
|
|
161
|
+
getInviteActionOffsetInDaysForNotResponsiveTenant,
|
|
140
162
|
getAutomaticRenewalsExpirationDates,
|
|
141
163
|
getLogTimestamp,
|
|
142
164
|
getDayInMilliseconds,
|
|
@@ -147,5 +169,7 @@ module.exports = {
|
|
|
147
169
|
convertDateToNewFormat,
|
|
148
170
|
getOneWeekAgoDate,
|
|
149
171
|
getOneWeekAheadDate,
|
|
150
|
-
convertDateToLongInt
|
|
172
|
+
convertDateToLongInt,
|
|
173
|
+
convertDateStringFormatToISOString,
|
|
174
|
+
inviteActionDateOffset
|
|
151
175
|
};
|
|
@@ -21,8 +21,7 @@ const policyNames = {
|
|
|
21
21
|
agreement: 'Agreement',
|
|
22
22
|
certificateHolder: 'Certificate Holder',
|
|
23
23
|
additionalInformation: 'Additional Information',
|
|
24
|
-
additionalInsured: 'Additional Insured'
|
|
25
|
-
businessInterruptionIncomeInsurance: 'Business Interruption / Income Insurance'
|
|
24
|
+
additionalInsured: 'Additional Insured'
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
const attributeNames = {
|
|
@@ -41,10 +40,7 @@ const attributeNames = {
|
|
|
41
40
|
coiAuthentication: 'COI authentication',
|
|
42
41
|
signature: 'Signature',
|
|
43
42
|
occur: 'Occur',
|
|
44
|
-
text: 'text'
|
|
45
|
-
indemnityPeriod: 'Indemnity Period',
|
|
46
|
-
actualLossSustained: 'Actual Loss Sustained',
|
|
47
|
-
extraExpense: 'Extra Expense'
|
|
43
|
+
text: 'text'
|
|
48
44
|
};
|
|
49
45
|
|
|
50
46
|
module.exports = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const coreService = require('../api/core/accounts.core.service');
|
|
2
2
|
const CreateAccountModel = require('../models/core/create.account.model');
|
|
3
|
-
const configsUtil = require('../../../../common/utils/configsUtil');
|
|
4
3
|
|
|
5
4
|
const getOrCreateAccount = (context, accountName, email, { password, type } = {}) => {
|
|
6
5
|
const createAccountModel = new CreateAccountModel(
|
|
@@ -31,12 +30,21 @@ const deleteAccountByName = async (context, accountName) => {
|
|
|
31
30
|
};
|
|
32
31
|
|
|
33
32
|
const isUIConfig = config => {
|
|
34
|
-
|
|
33
|
+
const convectorKeys = Object.keys(attributesConvertor);
|
|
34
|
+
const configKeys = Object.keys(config);
|
|
35
|
+
|
|
36
|
+
return convectorKeys.some(key => configKeys.includes(key));
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
const parseAccountSettingsConfig = (accountId, settingsConfig) => {
|
|
38
|
-
const settings =
|
|
39
|
-
|
|
40
|
+
const settings = { accountId };
|
|
41
|
+
|
|
42
|
+
for (const field in settingsConfig) {
|
|
43
|
+
const attributes = attributesConvertor[field];
|
|
44
|
+
settings[attributes] = JSON.parse(settingsConfig[field]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return settings;
|
|
40
48
|
};
|
|
41
49
|
|
|
42
50
|
module.exports = {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
2
2
|
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
3
|
|
|
4
|
+
const { convertDateStringFormatToISOString } = require('../../../../../common/utils/timeUtils');
|
|
5
|
+
|
|
4
6
|
const Endpoints = {
|
|
5
7
|
auditorContractorList: `${backendUrl}/saas/auditor/contractors`,
|
|
6
8
|
audit: `${backendUrl}/saas/auditor/contractors/submit/audits`,
|
|
@@ -10,7 +12,8 @@ const Endpoints = {
|
|
|
10
12
|
isReaudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/isreaudit`,
|
|
11
13
|
revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert`,
|
|
12
14
|
wrongCoi: `${backendUrl}/saas/coi/wrong-coi`,
|
|
13
|
-
getAudit: recordId => `${backendUrl}/saas/audit/${recordId}
|
|
15
|
+
getAudit: recordId => `${backendUrl}/saas/audit/${recordId}`,
|
|
16
|
+
updateComplianceAuditActionsDate: recordId => `${backendUrl}/saas/automation/record/${recordId}/update-audit-actions-date`
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
const audit = async (contractorId, auditRequestModel, context) => {
|
|
@@ -55,6 +58,11 @@ const wrongCoi = (recordId, context) => {
|
|
|
55
58
|
return requests.getRequestHandler(Endpoints.wrongCoi, params, context);
|
|
56
59
|
};
|
|
57
60
|
|
|
61
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
62
|
+
const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?offsetInDays=${dateOffset}`;
|
|
63
|
+
return requests.putRequestHandler(url, {}, context);
|
|
64
|
+
};
|
|
65
|
+
|
|
58
66
|
module.exports = {
|
|
59
67
|
audit,
|
|
60
68
|
submitAudit,
|
|
@@ -65,5 +73,6 @@ module.exports = {
|
|
|
65
73
|
enterAudit,
|
|
66
74
|
getAuditRecordModel,
|
|
67
75
|
getRequirementDetailsForAudit,
|
|
68
|
-
getAuditByRecordId
|
|
76
|
+
getAuditByRecordId,
|
|
77
|
+
updateComplianceAuditActionsDate
|
|
69
78
|
};
|
|
@@ -157,6 +157,10 @@ const auditRecord = async function(
|
|
|
157
157
|
return auditResponse;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
161
|
+
return auditApi.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
162
|
+
};
|
|
163
|
+
|
|
160
164
|
module.exports = {
|
|
161
165
|
audit,
|
|
162
166
|
submitAudit,
|
|
@@ -171,5 +175,6 @@ module.exports = {
|
|
|
171
175
|
getAuditMetadata,
|
|
172
176
|
getAuditByRecordId,
|
|
173
177
|
getAuditRequestModel,
|
|
174
|
-
auditRecord
|
|
178
|
+
auditRecord,
|
|
179
|
+
updateComplianceAuditActionsDate
|
|
175
180
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
2
|
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
const { convertDateStringFormatToISOString } = require('../../../../common/utils/timeUtils');
|
|
3
4
|
|
|
4
5
|
const Endpoints = {
|
|
5
6
|
create: `${backendUrl}/saas/contractors/invite`,
|
|
@@ -19,6 +20,7 @@ const Endpoints = {
|
|
|
19
20
|
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
20
21
|
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
21
22
|
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
23
|
+
updateLastInviteActionDate: recordId => `${backendUrl}/saas/automation/record/${recordId}/update-emails-date`,
|
|
22
24
|
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
23
25
|
`${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
24
26
|
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
@@ -126,6 +128,11 @@ const getLinkedProjectsCount = async (recordId, context) => {
|
|
|
126
128
|
return await requests.getRequestHandler(Endpoints.linkedProjectsCount(recordId), {}, context);
|
|
127
129
|
};
|
|
128
130
|
|
|
131
|
+
const updateLastInviteActionDate = (recordId, offsetInDays, context) => {
|
|
132
|
+
const url = `${Endpoints.updateLastInviteActionDate(recordId)}?offsetInDays=${offsetInDays}`;
|
|
133
|
+
return requests.putRequestHandler(url, {}, context);
|
|
134
|
+
};
|
|
135
|
+
|
|
129
136
|
module.exports = {
|
|
130
137
|
createContractor,
|
|
131
138
|
changeRequirement,
|
|
@@ -148,5 +155,6 @@ module.exports = {
|
|
|
148
155
|
resendInvitation,
|
|
149
156
|
muteNotifications,
|
|
150
157
|
unmuteNotifications,
|
|
151
|
-
getLinkedProjectsCount
|
|
158
|
+
getLinkedProjectsCount,
|
|
159
|
+
updateLastInviteActionDate
|
|
152
160
|
};
|
|
@@ -54,6 +54,10 @@ const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
|
54
54
|
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
const updateLastInviteActionDate = (recordId, dateOffset, context) => {
|
|
58
|
+
return contractorsAPI.updateLastInviteActionDate(recordId, dateOffset, context);
|
|
59
|
+
};
|
|
60
|
+
|
|
57
61
|
const getContractorsByTabId = (tabId, context, activityStatus = 'Active') => {
|
|
58
62
|
return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
|
|
59
63
|
};
|
|
@@ -184,5 +188,6 @@ module.exports = {
|
|
|
184
188
|
assignRequirement,
|
|
185
189
|
getAssignRequirementModel,
|
|
186
190
|
getLinkedProjectsCount,
|
|
187
|
-
restoreByRecordId
|
|
191
|
+
restoreByRecordId,
|
|
192
|
+
updateLastInviteActionDate
|
|
188
193
|
};
|
|
@@ -5,7 +5,6 @@ const Endpoints = {
|
|
|
5
5
|
invite: `${backendUrl}/saas/project/team-member`,
|
|
6
6
|
editUserProjects: `${backendUrl}/saas/project/team-member`,
|
|
7
7
|
editUserRole: userId => `${backendUrl}/secured/users/${userId}/change-role`,
|
|
8
|
-
editUserProfile: `${backendUrl}/saas/user/update`,
|
|
9
8
|
getByProjectId: projectId =>
|
|
10
9
|
`${backendUrl}/saas/project/${projectId}/team-members`,
|
|
11
10
|
getByEmail: email => `${backendUrl}/saas/team-member/by-email/${email}`,
|
|
@@ -85,9 +84,6 @@ const sendForgetPasswordMail = userEmail => {
|
|
|
85
84
|
const body = { email: userEmail };
|
|
86
85
|
return requests.postRequestHandler(Endpoints.sendForgetPasswordMail, body);
|
|
87
86
|
};
|
|
88
|
-
const editUserProfile = (editUserProfileModel, context) => {
|
|
89
|
-
return requests.postRequestHandler(Endpoints.editUserProfile, editUserProfileModel, context);
|
|
90
|
-
};
|
|
91
87
|
|
|
92
88
|
module.exports = {
|
|
93
89
|
invite,
|
|
@@ -104,6 +100,5 @@ module.exports = {
|
|
|
104
100
|
editUserEmailNotificationsSettings,
|
|
105
101
|
sendForgetPasswordMail,
|
|
106
102
|
createInnerSystemUser,
|
|
107
|
-
getInnerSystemUsersPerRole
|
|
108
|
-
editUserProfile
|
|
103
|
+
getInnerSystemUsersPerRole
|
|
109
104
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { InviteUserModel, SignupUserModel, EditUserModel
|
|
1
|
+
const { InviteUserModel, SignupUserModel, EditUserModel } = require('../models/users.model');
|
|
2
2
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
3
3
|
const { getEnv } = require('../../../../env');
|
|
4
4
|
const { credentials } = getEnv();
|
|
@@ -147,33 +147,6 @@ const sendForgetPasswordMail = userEmail => {
|
|
|
147
147
|
return userAPI.sendForgetPasswordMail(userEmail);
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
const editUserProfile = async (email, fullName, context) => {
|
|
151
|
-
const { data: user } = await getUserByEmail(email, context);
|
|
152
|
-
|
|
153
|
-
const editUserProfileModel = new EditUserProfileModel(user.id, email, user.role, fullName);
|
|
154
|
-
|
|
155
|
-
const response = await userAPI.editUserProfile(editUserProfileModel, context);
|
|
156
|
-
|
|
157
|
-
if (response.status !== httpResponseStatusCodes.OK) {
|
|
158
|
-
throw Error(`Failed to edit user id: [${user.id}] profile\n${response}`);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return getUserByEmail(email, context);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const editUserSettings = async (email, config, context) => {
|
|
165
|
-
const { data: user } = await getUserByEmail(email, context);
|
|
166
|
-
const settingModel = util.getSettingsModel(config);
|
|
167
|
-
|
|
168
|
-
const response = await userAPI.editUserEmailNotificationsSettings(user.id, settingModel, context);
|
|
169
|
-
|
|
170
|
-
if (response.status !== httpResponseStatusCodes.OK) {
|
|
171
|
-
throw Error(`Failed to edit user id: [${user.id}] settings\n${response}`);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return getUserByEmail(email, context);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
150
|
module.exports = {
|
|
178
151
|
inviteUser,
|
|
179
152
|
signupUser,
|
|
@@ -189,7 +162,5 @@ module.exports = {
|
|
|
189
162
|
reinviteUser,
|
|
190
163
|
editUserEmailNotificationsSettings,
|
|
191
164
|
sendForgetPasswordMail,
|
|
192
|
-
getOrCreateInnerSystemUser
|
|
193
|
-
editUserProfile,
|
|
194
|
-
editUserSettings
|
|
165
|
+
getOrCreateInnerSystemUser
|
|
195
166
|
};
|
|
@@ -24,18 +24,8 @@ class EditUserModel {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
class EditUserProfileModel {
|
|
28
|
-
constructor(subUserId, email, role, fullName) {
|
|
29
|
-
this.subUserId = subUserId;
|
|
30
|
-
this.email = email;
|
|
31
|
-
this.role = role;
|
|
32
|
-
this.fullName = fullName;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
27
|
module.exports = {
|
|
37
28
|
InviteUserModel,
|
|
38
29
|
SignupUserModel,
|
|
39
|
-
EditUserModel
|
|
40
|
-
EditUserProfileModel
|
|
30
|
+
EditUserModel
|
|
41
31
|
};
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
const { SignupUserModel } = require('../models/users.model');
|
|
2
|
-
const { NotificationSettingsModel } = require('../models/notification.settings.model');
|
|
3
2
|
const usersApi = require('../api/users.api');
|
|
4
3
|
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
5
|
-
const objectUtils = require('../../../../common/utils/configsUtil');
|
|
6
|
-
|
|
7
|
-
const attributesConvertor = {
|
|
8
|
-
'COI is not compliant.': 'auditNotCompliant',
|
|
9
|
-
'Policy is about to expire.': 'aboutToExpire',
|
|
10
|
-
'COI is compliant.': 'auditCompliant',
|
|
11
|
-
'Unresponsive contact.': 'missingCoi'
|
|
12
|
-
};
|
|
13
4
|
|
|
14
5
|
const getUserEncryptedData = async (email, role, context) => {
|
|
15
6
|
const response = await usersApi.getUserEncryptedData(email, role, context);
|
|
@@ -26,14 +17,4 @@ const getSignupUserModel = async (email, role, fullName, password, context) => {
|
|
|
26
17
|
return new SignupUserModel(fullName, role, password, userEncryptedData);
|
|
27
18
|
};
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
const isUIConfig = objectUtils.isUIConfig(settings, attributesConvertor);
|
|
31
|
-
|
|
32
|
-
const settingConfig = isUIConfig ?
|
|
33
|
-
objectUtils.objectConvertor(settings, attributesConvertor) :
|
|
34
|
-
settings;
|
|
35
|
-
|
|
36
|
-
return new NotificationSettingsModel(settingConfig);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
module.exports = { getSignupUserModel, getSettingsModel };
|
|
20
|
+
module.exports = { getSignupUserModel };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const isUIConfig = (config, attributesConvertor) => {
|
|
2
|
-
const converterKeys = Object.keys(attributesConvertor);
|
|
3
|
-
const configKeys = Object.keys(config);
|
|
4
|
-
|
|
5
|
-
return converterKeys.some(key => configKeys.includes(key));
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const objectConvertor = (config, attributesConvertor) => {
|
|
9
|
-
const covertConfig = {};
|
|
10
|
-
|
|
11
|
-
for (const field in config) {
|
|
12
|
-
const attributes = attributesConvertor[field];
|
|
13
|
-
covertConfig[attributes] = JSON.parse(config[field]);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return covertConfig;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
isUIConfig,
|
|
21
|
-
objectConvertor
|
|
22
|
-
};
|
|
Binary file
|