@getjones/test-infra 2.9.6 → 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/consts/userTypes.js +1 -1
- package/src/common/utils/objectUtils.js +1 -21
- package/src/common/utils/timeUtils.js +25 -1
- package/src/saas/internal-api/auth/api/auth.api.js +4 -4
- package/src/saas/internal-api/auth/api/auth.service.js +2 -2
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +11 -2
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +14 -2
- 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/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/saas/openapi/projects/projects.api.js +2 -2
- package/src/saas/openapi/projects/projects.service.js +2 -2
- package/src/saas/openapi/requirements/requirements.api.js +8 -2
- package/src/saas/openapi/requirements/requirements.service.js +6 -1
- package/src/saas/openapi/tabs/tabs.api.js +7 -2
- package/src/saas/openapi/tabs/tabs.service.js +4 -1
- 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
|
};
|
|
@@ -2,26 +2,6 @@ const cloneObject = object => {
|
|
|
2
2
|
return JSON.parse(JSON.stringify(object));
|
|
3
3
|
};
|
|
4
4
|
|
|
5
|
-
const isUIConfig = (config, attributesConvertor) => {
|
|
6
|
-
const convectorKeys = Object.keys(attributesConvertor);
|
|
7
|
-
const configKeys = Object.keys(config);
|
|
8
|
-
|
|
9
|
-
return convectorKeys.some(key => configKeys.includes(key));
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const objectConvertor = (config, attributesConvertor) => {
|
|
13
|
-
const covertConfig = {};
|
|
14
|
-
|
|
15
|
-
for (const field in config) {
|
|
16
|
-
const attributes = attributesConvertor[field];
|
|
17
|
-
covertConfig[attributes] = JSON.parse(config[field]);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return covertConfig;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
5
|
module.exports = {
|
|
24
|
-
cloneObject
|
|
25
|
-
isUIConfig,
|
|
26
|
-
objectConvertor
|
|
6
|
+
cloneObject
|
|
27
7
|
};
|
|
@@ -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
|
};
|
|
@@ -5,7 +5,7 @@ const Endpoints = {
|
|
|
5
5
|
login: `${backendUrl}/logincontroller`,
|
|
6
6
|
verifyEmail: `${backendUrl}/verify/email`,
|
|
7
7
|
createOneTimeSession: `${backendUrl}/vendor-app/one-time-session/create`,
|
|
8
|
-
|
|
8
|
+
verifyUser: `${backendUrl}/vendor-app/one-time-session/verify-user`
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const login = (email, password) => {
|
|
@@ -20,8 +20,8 @@ const createOneTimeSession = email => {
|
|
|
20
20
|
return requests.postRequestHandler(Endpoints.createOneTimeSession, { email });
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
return requests.
|
|
23
|
+
const verifyUser = (email, oneTimeCode) => {
|
|
24
|
+
return requests.postRequestHandler(Endpoints.verifyUser, { email, oneTimeCode });
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
module.exports = { login, verifyEmail, createOneTimeSession,
|
|
27
|
+
module.exports = { login, verifyEmail, createOneTimeSession, verifyUser };
|
|
@@ -39,9 +39,9 @@ const createOneTimeSession = email => {
|
|
|
39
39
|
|
|
40
40
|
const getHubUserCookie = async (email, oneTimeCode) => {
|
|
41
41
|
try {
|
|
42
|
-
const response = await authApi.
|
|
42
|
+
const response = await authApi.verifyUser(email, oneTimeCode);
|
|
43
43
|
|
|
44
|
-
if (response.status !== httpResponseStatusCodes.OK) {
|
|
44
|
+
if (response.status !== httpResponseStatusCodes.OK && response.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
45
45
|
throw Error(`Error: ${JSON.stringify(response.data)}`);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -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
|
};
|
|
@@ -5,6 +5,7 @@ const auditUtil = require('../../utils/auditUtil');
|
|
|
5
5
|
const dataTypeUtils = require('../../../../../common/utils/dataTypeUtils');
|
|
6
6
|
const { cloneObject } = require('../../../../../common/utils/objectUtils');
|
|
7
7
|
const complianceUtil = require('../../../../../common/utils/complianceUtil');
|
|
8
|
+
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
8
9
|
|
|
9
10
|
const audit = (auditRequestModel, context) => {
|
|
10
11
|
validateType(auditRequestModel, AuditRequestModel);
|
|
@@ -71,7 +72,13 @@ const getAuditMetadata = async (
|
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
const getAuditByRecordId = async (recordId, context, { isRecordDeleted } = {}) => {
|
|
74
|
-
|
|
75
|
+
const responseAudit = await auditApi.getAuditByRecordId(recordId, context, { isRecordDeleted });
|
|
76
|
+
|
|
77
|
+
if (responseAudit.status !== httpResponseStatusCodes.OK) {
|
|
78
|
+
throw Error(`Failed to get audits by record id\n${responseAudit}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return responseAudit.data;
|
|
75
82
|
};
|
|
76
83
|
|
|
77
84
|
const getAuditEntities = async (recordId, auditData, auditorContext) => {
|
|
@@ -150,6 +157,10 @@ const auditRecord = async function(
|
|
|
150
157
|
return auditResponse;
|
|
151
158
|
};
|
|
152
159
|
|
|
160
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
161
|
+
return auditApi.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
162
|
+
};
|
|
163
|
+
|
|
153
164
|
module.exports = {
|
|
154
165
|
audit,
|
|
155
166
|
submitAudit,
|
|
@@ -164,5 +175,6 @@ module.exports = {
|
|
|
164
175
|
getAuditMetadata,
|
|
165
176
|
getAuditByRecordId,
|
|
166
177
|
getAuditRequestModel,
|
|
167
|
-
auditRecord
|
|
178
|
+
auditRecord,
|
|
179
|
+
updateComplianceAuditActionsDate
|
|
168
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/objectUtils');
|
|
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 };
|
|
@@ -16,8 +16,8 @@ const getProjectsByName = async (apiKey, params) => {
|
|
|
16
16
|
return requests.getRequestHandler(Endpoints.getProjectsByName, apiKey, params).then(res => res.data);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const getAllProjects = async apiKey => {
|
|
20
|
-
return requests.getRequestHandler(Endpoints.getAllProjects, apiKey).then(res => res
|
|
19
|
+
const getAllProjects = async (apiKey, params) => {
|
|
20
|
+
return requests.getRequestHandler(Endpoints.getAllProjects, apiKey, params).then(res => res);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const getModifiedProjects = async (apiKey, params) => {
|
|
@@ -12,8 +12,8 @@ const updateProject = async (apiKey, projectId, projectData) => {
|
|
|
12
12
|
return projectsApi.updateProject(apiKey, projectId, projectData);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const getAllProjects = async apiKey => {
|
|
16
|
-
return projectsApi.getAllProjects(apiKey);
|
|
15
|
+
const getAllProjects = async (apiKey, params) => {
|
|
16
|
+
return projectsApi.getAllProjects(apiKey, params);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const getModifiedProjects = async (apiKey, timestamp) => {
|
|
@@ -4,7 +4,8 @@ const { openapiUrl } = require('../../../env').getEnv();
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
copyRequirement: sourceRequirementId => `${openapiUrl}/requirement/${sourceRequirementId}/copy`,
|
|
6
6
|
getRequirementsByTabId: tabId => `${openapiUrl}/tabs/${tabId}/requirements`,
|
|
7
|
-
getRequirementsByProjectId: projectId => `${openapiUrl}/properties/${projectId}/requirements
|
|
7
|
+
getRequirementsByProjectId: projectId => `${openapiUrl}/properties/${projectId}/requirements`,
|
|
8
|
+
getRequirementsList: `${openapiUrl}/requirement/all`
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
const copyRequirement = (apiKey, sourceRequirementId, newRequirementOverrides) => {
|
|
@@ -19,8 +20,13 @@ const getRequirementsByProjectId = (apiKey, projectId, tabType) => {
|
|
|
19
20
|
return requests.getRequestHandler(Endpoints.getRequirementsByProjectId(projectId), apiKey, { tabType });
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
const getRequirementsList = (apiKey, params) => {
|
|
24
|
+
return requests.getRequestHandler(Endpoints.getRequirementsList, apiKey, params);
|
|
25
|
+
};
|
|
26
|
+
|
|
22
27
|
module.exports = {
|
|
23
28
|
copyRequirement,
|
|
24
29
|
getRequirementsByTabId,
|
|
25
|
-
getRequirementsByProjectId
|
|
30
|
+
getRequirementsByProjectId,
|
|
31
|
+
getRequirementsList
|
|
26
32
|
};
|
|
@@ -25,8 +25,13 @@ const getRequirementsByProjectId = (apiKey, projectId, tabType) => {
|
|
|
25
25
|
return requirementsApi.getRequirementsByProjectId(apiKey, projectId, tabType);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
const getRequirementsList = (apiKey, params) => {
|
|
29
|
+
return requirementsApi.getRequirementsList(apiKey, params);
|
|
30
|
+
};
|
|
31
|
+
|
|
28
32
|
module.exports = {
|
|
29
33
|
copyRequirement,
|
|
30
34
|
getRequirementsByTabId,
|
|
31
|
-
getRequirementsByProjectId
|
|
35
|
+
getRequirementsByProjectId,
|
|
36
|
+
getRequirementsList
|
|
32
37
|
};
|
|
@@ -4,7 +4,8 @@ const { openapiUrl, backendUrl } = require('../../../env').getEnv();
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
delete: tabId => `${openapiUrl}/tabs/${tabId}`,
|
|
6
6
|
get: tabId => `${backendUrl}/tabs/${tabId}`,
|
|
7
|
-
create: projectId => `${openapiUrl}/properties/${projectId}/tab
|
|
7
|
+
create: projectId => `${openapiUrl}/properties/${projectId}/tab`,
|
|
8
|
+
getAll: `${openapiUrl}/tabs/all`
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
const deleteTabById = (tabId, apiKey) => {
|
|
@@ -15,4 +16,8 @@ const createTab = (projectId, createTabModel, apiKey) => {
|
|
|
15
16
|
return requests.postRequestHandler(Endpoints.create(projectId), apiKey, createTabModel);
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
const getAllTabs = (apiKey, params) => {
|
|
20
|
+
return requests.getRequestHandler(Endpoints.getAll, apiKey, params);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports = { deleteTabById, createTab, getAllTabs };
|
|
@@ -8,4 +8,7 @@ const createTab = (projectId, createTabModel, apiKey) => {
|
|
|
8
8
|
return tabsApi.createTab(projectId, createTabModel, apiKey);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const getAllTabs = (apiKey, params) => {
|
|
12
|
+
return tabsApi.getAllTabs(apiKey, params);
|
|
13
|
+
};
|
|
14
|
+
module.exports = { deleteTabById, createTab, getAllTabs };
|
|
Binary file
|