@getjones/test-infra 2.7.3 → 2.7.5
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/saas/internal-api/accounts/api/settings/settings.service.js +19 -1
- package/src/saas/internal-api/accounts/utils/utils.js +35 -1
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +12 -12
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +3 -3
- package/src/saas/internal-api/contractors/api/contractors.api.js +8 -2
- package/src/saas/internal-api/contractors/api/contractors.service.js +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const accountsAPI = require('./settings.api');
|
|
2
2
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
3
3
|
const UpdateAccountSettingsModel = require('../../models/settings/update.settings.model');
|
|
4
|
+
const util = require('../../utils/utils');
|
|
5
|
+
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
4
6
|
|
|
5
7
|
const getAccountSettings = (accountId, context) => {
|
|
6
8
|
return accountsAPI.getAccountSettings(accountId, context);
|
|
@@ -16,8 +18,24 @@ const restoreAccountSettings = (accountId, context) => {
|
|
|
16
18
|
return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
const setAccountSettings = async (accountId, settings, context) => {
|
|
22
|
+
const isUIConfig = util.isUIConfig(settings);
|
|
23
|
+
|
|
24
|
+
const settingsConfig = isUIConfig ? util.parseAccountSettingsConfig(accountId, settings) : settings;
|
|
25
|
+
const settingsModel = new UpdateAccountSettingsModel(accountId, { ... settingsConfig });
|
|
26
|
+
|
|
27
|
+
const updateResponse = await updateAccountSettings(settingsModel, context);
|
|
28
|
+
|
|
29
|
+
if (updateResponse.status !== httpResponseStatusCodes.OK) {
|
|
30
|
+
throw new Error(`Failed to set account: ${accountId} settings\n${updateResponse}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return updateResponse;
|
|
34
|
+
};
|
|
35
|
+
|
|
19
36
|
module.exports = {
|
|
20
37
|
getAccountSettings,
|
|
21
38
|
updateAccountSettings,
|
|
22
|
-
restoreAccountSettings
|
|
39
|
+
restoreAccountSettings,
|
|
40
|
+
setAccountSettings
|
|
23
41
|
};
|
|
@@ -29,4 +29,38 @@ const deleteAccountByName = async (context, accountName) => {
|
|
|
29
29
|
return existingAccount && coreService.deleteAccountById(existingAccount.userId, context);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const isUIConfig = config => {
|
|
33
|
+
const convectorKeys = Object.keys(attributesConvertor);
|
|
34
|
+
const configKeys = Object.keys(config);
|
|
35
|
+
|
|
36
|
+
return convectorKeys.some(key => configKeys.includes(key));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const parseAccountSettingsConfig = (accountId, settingsConfig) => {
|
|
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;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
getOrCreateAccount,
|
|
52
|
+
createAccount,
|
|
53
|
+
deleteAccountByName,
|
|
54
|
+
parseAccountSettingsConfig,
|
|
55
|
+
isUIConfig
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const attributesConvertor = {
|
|
59
|
+
'Enable high priority in auditor portal': 'isHighPriority',
|
|
60
|
+
'Analytics Dashboard': 'hasAnalyticsDashboard',
|
|
61
|
+
'Email on welcome page experiment': 'isEmailOnWelcomePageVA',
|
|
62
|
+
'Exclude account records from the Jones Network': 'isExcludedFromNetwork',
|
|
63
|
+
'OCR Audit Enabled': 'isOcrEnabled',
|
|
64
|
+
'Coverage Auditing': 'isCoverageAudit',
|
|
65
|
+
'Account Requirements': 'isAccountRequirementsEnabled'
|
|
66
|
+
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
const { getEnv, getSystemUserIdentity } = require('../../../../../env');
|
|
2
|
-
const { credentials } = getEnv();
|
|
3
|
-
|
|
4
1
|
const coverageApi = require('./coverage.api');
|
|
5
2
|
const { getAuditMetadata } = require('../../../../../common/utils/complianceUtil');
|
|
6
|
-
const { getCoverageConfig } = require('../../utils/coverageUtil');
|
|
3
|
+
const { getCoverageConfig, getAllAvailablePolicies } = require('../../utils/coverageUtil');
|
|
7
4
|
|
|
8
5
|
const saveCoverageNode = (coverage, nodeBackendSecret) => {
|
|
9
6
|
return coverageApi.saveCoverageNode(coverage, nodeBackendSecret);
|
|
@@ -22,20 +19,23 @@ const deleteCoverageByCoiId = (coiId, icsContext) => {
|
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
const addCoverage = async function(
|
|
22
|
+
auditorContext,
|
|
25
23
|
accountId,
|
|
26
24
|
projectId,
|
|
27
25
|
requirementId,
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
record,
|
|
27
|
+
coveragePolicesList
|
|
30
28
|
) {
|
|
31
|
-
const
|
|
32
|
-
const
|
|
29
|
+
const coiId = record.certificatePdf.split('contractor').shift();
|
|
30
|
+
const recordId = record.contractorId;
|
|
31
|
+
|
|
32
|
+
const { auditDates } = await getAuditMetadata(auditorContext, accountId, projectId, requirementId, recordId);
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
getCoverageConfig(
|
|
36
|
-
|
|
34
|
+
const coverageConfig = Array.isArray(coveragePolicesList) ?
|
|
35
|
+
getCoverageConfig(coiId, coveragePolicesList) :
|
|
36
|
+
getCoverageConfig(coiId, getAllAvailablePolicies());
|
|
37
37
|
|
|
38
|
-
const coverageResponse = await saveCoverageJava(auditorContext, auditDates,
|
|
38
|
+
const coverageResponse = await saveCoverageJava(auditorContext, auditDates, coverageConfig);
|
|
39
39
|
return coverageResponse;
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -4,9 +4,9 @@ const WAIVE_ACTIONS = {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
const WAIVER_REASONS = {
|
|
7
|
-
BUSINESS_DECISION: '
|
|
8
|
-
NO_EXPOSURE: '
|
|
9
|
-
EXECUTIVE_APPROVAL: '
|
|
7
|
+
BUSINESS_DECISION: 'Business Decision',
|
|
8
|
+
NO_EXPOSURE: 'No Exposure',
|
|
9
|
+
EXECUTIVE_APPROVAL: 'Executive Approval'
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
function WaiveRequestModel({
|
|
@@ -22,7 +22,8 @@ const Endpoints = {
|
|
|
22
22
|
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
23
23
|
`${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
24
24
|
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
25
|
-
assignRequirement: recordId => `${backendUrl}/saas/contractor/${recordId}/assign-requirement
|
|
25
|
+
assignRequirement: recordId => `${backendUrl}/saas/contractor/${recordId}/assign-requirement`,
|
|
26
|
+
linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects`
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
const createContractor = (createContractorModel, context) => {
|
|
@@ -122,6 +123,10 @@ const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
|
122
123
|
return requests.patchRequestHandler(url, context);
|
|
123
124
|
};
|
|
124
125
|
|
|
126
|
+
const getLinkedProjectsCount = async (recordId, context) => {
|
|
127
|
+
return await requests.getRequestHandler(Endpoints.linkedProjectsCount(recordId), {}, context);
|
|
128
|
+
};
|
|
129
|
+
|
|
125
130
|
module.exports = {
|
|
126
131
|
createContractor,
|
|
127
132
|
changeRequirement,
|
|
@@ -143,5 +148,6 @@ module.exports = {
|
|
|
143
148
|
requestNewCoiExpired,
|
|
144
149
|
resendInvitation,
|
|
145
150
|
muteNotifications,
|
|
146
|
-
unmuteNotifications
|
|
151
|
+
unmuteNotifications,
|
|
152
|
+
getLinkedProjectsCount
|
|
147
153
|
};
|
|
@@ -136,6 +136,10 @@ const getAssignRequirementModel = (requirementId, companyName, emailAddress) =>
|
|
|
136
136
|
return new AssignRequirementModel(requirementId, companyName, emailAddress);
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
+
const getLinkedProjectsCount = (recordId, context) => {
|
|
140
|
+
return contractorsAPI.getLinkedProjectsCount(recordId, context);
|
|
141
|
+
};
|
|
142
|
+
|
|
139
143
|
module.exports = {
|
|
140
144
|
createContractor,
|
|
141
145
|
changeRequirement,
|
|
@@ -160,5 +164,6 @@ module.exports = {
|
|
|
160
164
|
deleteAllRecordsInAccount,
|
|
161
165
|
getRecordVerificationModel,
|
|
162
166
|
assignRequirement,
|
|
163
|
-
getAssignRequirementModel
|
|
167
|
+
getAssignRequirementModel,
|
|
168
|
+
getLinkedProjectsCount
|
|
164
169
|
};
|