@getjones/test-infra 4.5.8 → 4.5.9
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/consts/accountSettings.js +4 -0
- package/src/common/consts/homepage/AttentionTab.js +1 -1
- package/src/common/consts/homepage/sortOptions.js +6 -1
- package/src/common/utils/complianceUtil.js +5 -3
- package/src/factory/records/records.js +1 -0
- package/src/resources/virusFile.pdf +0 -0
- package/src/saas/internal-api/accounts/utils/utils.js +2 -1
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +42 -22
- package/src/saas/internal-api/requests/models/homepageRequestCriteriaModel.js +1 -1
package/package.json
CHANGED
|
@@ -11,6 +11,10 @@ module.exports = {
|
|
|
11
11
|
on: { hasPolicyVerification: true },
|
|
12
12
|
off: { hasPolicyVerification: false }
|
|
13
13
|
},
|
|
14
|
+
isAuditingAiEnabled: {
|
|
15
|
+
on: { isAuditingAiEnabled: true },
|
|
16
|
+
off: { isAuditingAiEnabled: false }
|
|
17
|
+
},
|
|
14
18
|
integrations: {
|
|
15
19
|
vendorsAndTenantsON: {
|
|
16
20
|
integrations: {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const sortBy = {
|
|
2
2
|
companyName: 'company_name',
|
|
3
|
-
coi: 'coi'
|
|
3
|
+
coi: 'coi',
|
|
4
|
+
externalRecordId: 'external_record_id',
|
|
5
|
+
insuranceStatus: 'insurance_status',
|
|
6
|
+
expiryDate: 'min_policy_expiry',
|
|
7
|
+
projectName: 'project_name',
|
|
8
|
+
accountName: 'companyname'
|
|
4
9
|
};
|
|
5
10
|
|
|
6
11
|
const sortOrder = {
|
|
@@ -36,7 +36,8 @@ const prepareMetadataForAudit = async (
|
|
|
36
36
|
recordId,
|
|
37
37
|
{
|
|
38
38
|
isProjectOnboarding = false,
|
|
39
|
-
shouldSendNotificationToPM = false
|
|
39
|
+
shouldSendNotificationToPM = false,
|
|
40
|
+
dateStartedAudit
|
|
40
41
|
} = {}) => {
|
|
41
42
|
const metadata = {
|
|
42
43
|
accountId,
|
|
@@ -50,7 +51,7 @@ const prepareMetadataForAudit = async (
|
|
|
50
51
|
const isReauditResponse = await isReaudit(recordId, auditorContext);
|
|
51
52
|
metadata.isReaudit = isReauditResponse.data.isReaudit;
|
|
52
53
|
|
|
53
|
-
const enterAuditResponse = await auditApi.enterAudit(recordId, auditorContext); //moved up here
|
|
54
|
+
// const enterAuditResponse = await auditApi.enterAudit(recordId, auditorContext); //moved up here //remove from here
|
|
54
55
|
|
|
55
56
|
const recordDetailsResponse = await auditApi.getAuditRecordModel(recordId, auditorContext);
|
|
56
57
|
const recordDetails = recordDetailsResponse.data;
|
|
@@ -62,7 +63,8 @@ const prepareMetadataForAudit = async (
|
|
|
62
63
|
metadata.auditDates = {
|
|
63
64
|
contractorId: recordId,
|
|
64
65
|
contractorDateModified: recordDetails.dateModified,
|
|
65
|
-
dateStartedAudit:
|
|
66
|
+
dateStartedAudit: dateStartedAudit,
|
|
67
|
+
// dateStartedAudit: enterAuditResponse.data.dateStartedAudit,
|
|
66
68
|
contractorOverrideDateModified: recordDetails.contractorOverrideDateModified,
|
|
67
69
|
contractCreateDate: recordDetails.contractCreateDate,
|
|
68
70
|
auditDateModified: currentAudit.dateModified
|
|
Binary file
|
|
@@ -56,5 +56,6 @@ const attributesConvertor = {
|
|
|
56
56
|
'Coverage Auditing': 'isCoverageAudit',
|
|
57
57
|
'Account Requirements': 'isAccountRequirementsEnabled',
|
|
58
58
|
'Skip 50 miles autocomplete limitation': 'isWithoutAutocompleteDistanceLimitation',
|
|
59
|
-
'Policy Verification': 'hasPolicyVerification'
|
|
59
|
+
'Policy Verification': 'hasPolicyVerification',
|
|
60
|
+
'Auditing AI Enabled': 'isAuditingAiEnabled'
|
|
60
61
|
};
|
|
@@ -13,9 +13,16 @@ const httpResponseStatusCodes = require('../../../../../common/httpResponseStatu
|
|
|
13
13
|
// return auditApi.submitAudit(auditRequestModel, context); //switched to this
|
|
14
14
|
// };
|
|
15
15
|
|
|
16
|
-
const submitAudit = (auditRequestModel, context) => {
|
|
16
|
+
const submitAudit = async (auditRequestModel, context, { expectError } = {}) => {
|
|
17
17
|
validateType(auditRequestModel, AuditRequestModel);
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
const submitAuditResponse = await auditApi.submitAudit(auditRequestModel, context);
|
|
20
|
+
|
|
21
|
+
if (submitAuditResponse.status !== httpResponseStatusCodes.NO_CONTENT && !expectError) {
|
|
22
|
+
throw new Error(`Failed to submit audit for record: ${auditRequestModel.auditDates.contractorId}. \n${submitAuditResponse.status}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return submitAuditResponse;
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
const revertCoi = (contractorId, dateModified, context) => {
|
|
@@ -36,25 +43,25 @@ const getAuditorContractorList = (auditListParametersModel, context) => {
|
|
|
36
43
|
return auditApi.getAuditorContractorList(auditListParametersModel, context);
|
|
37
44
|
};
|
|
38
45
|
|
|
39
|
-
const getAuditRequestModelAfterEnterAudit = async (accountId, projectId, requirementId, recordId, auditConfig, context) => {
|
|
40
|
-
const metadata = await prepareMetadataForAudit(context, accountId, projectId, requirementId, recordId);
|
|
46
|
+
const getAuditRequestModelAfterEnterAudit = async (accountId, projectId, requirementId, recordId, auditConfig, context, { shouldSendNotificationToPM, dateStartedAudit } = {}) => {
|
|
47
|
+
const metadata = await prepareMetadataForAudit(context, accountId, projectId, requirementId, recordId, { shouldSendNotificationToPM, dateStartedAudit });
|
|
41
48
|
const auditEntities = await getAuditEntities(recordId, auditConfig, context);
|
|
42
49
|
const auditRequestModel = getAuditRequestModel(metadata, auditEntities);
|
|
43
50
|
|
|
44
51
|
return auditRequestModel;
|
|
45
52
|
};
|
|
46
53
|
|
|
47
|
-
const enterAudit = async (recordId, context, {
|
|
48
|
-
|
|
49
|
-
if (shouldGetAuditRequestModelAfterEnterAudit) {
|
|
50
|
-
return getAuditRequestModelAfterEnterAudit(accountId, projectId, requirementId, recordId, auditConfig, context);
|
|
51
|
-
} else {
|
|
52
|
-
const enterAuditResponse = await auditApi.enterAudit(recordId, context);
|
|
54
|
+
const enterAudit = async (recordId, context, { shouldSendNotificationToPM, shouldGetAuditRequestModelAfterEnterAudit, accountId, projectId, requirementId, auditConfig } = {}) => {
|
|
55
|
+
const enterAuditResponse = await auditApi.enterAudit(recordId, context);
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
if (enterAuditResponse.status !== httpResponseStatusCodes.OK) {
|
|
58
|
+
throw Error(`Failed to enter audit\n$response - ${enterAuditResponse.status}\n${JSON.stringify(enterAuditResponse.data)}`);
|
|
59
|
+
}
|
|
57
60
|
|
|
61
|
+
if (shouldGetAuditRequestModelAfterEnterAudit) {
|
|
62
|
+
const dateStartedAudit = enterAuditResponse.data.dateStartedAudit;
|
|
63
|
+
return getAuditRequestModelAfterEnterAudit(accountId, projectId, requirementId, recordId, auditConfig, context, { shouldSendNotificationToPM, dateStartedAudit });
|
|
64
|
+
} else {
|
|
58
65
|
return enterAuditResponse;
|
|
59
66
|
}
|
|
60
67
|
|
|
@@ -88,7 +95,8 @@ const prepareMetadataForAudit = async (
|
|
|
88
95
|
recordId,
|
|
89
96
|
{
|
|
90
97
|
isProjectOnboarding,
|
|
91
|
-
shouldSendNotificationToPM
|
|
98
|
+
shouldSendNotificationToPM,
|
|
99
|
+
dateStartedAudit
|
|
92
100
|
} = {}
|
|
93
101
|
) => {
|
|
94
102
|
return complianceUtil.prepareMetadataForAudit(
|
|
@@ -99,7 +107,8 @@ const prepareMetadataForAudit = async (
|
|
|
99
107
|
recordId,
|
|
100
108
|
{
|
|
101
109
|
isProjectOnboarding,
|
|
102
|
-
shouldSendNotificationToPM
|
|
110
|
+
shouldSendNotificationToPM,
|
|
111
|
+
dateStartedAudit
|
|
103
112
|
}
|
|
104
113
|
);
|
|
105
114
|
};
|
|
@@ -177,20 +186,31 @@ const auditRecord = async function(
|
|
|
177
186
|
requirementId,
|
|
178
187
|
recordId,
|
|
179
188
|
auditConfig,
|
|
180
|
-
{ shouldSendNotificationToPM = false } = {}
|
|
189
|
+
{ shouldSendNotificationToPM = false, expectError } = {}
|
|
181
190
|
) {
|
|
182
|
-
const
|
|
191
|
+
// const dateStartedAudit = AuditRequestModel.auditDates.dateStartedAudit;
|
|
192
|
+
// const auditMetadata = await prepareMetadataForAudit(auditorContext, accountId, projectId, requirementId, recordId, { shouldSendNotificationToPM, dateStartedAudit });
|
|
183
193
|
|
|
184
|
-
const
|
|
194
|
+
const apiAuditConfig = dataTypeUtils.isObject(auditConfig) ?
|
|
185
195
|
auditUtil.parseAuditConfig(cloneObject(auditConfig)) :
|
|
186
196
|
auditConfig;
|
|
187
197
|
|
|
188
|
-
|
|
189
|
-
const auditRequestModel =
|
|
198
|
+
//enter audit + extract enterAuditResponse.data.dateStartedAudit and send it to prepareMetadataForAudit
|
|
199
|
+
const auditRequestModel = await enterAudit(recordId, auditorContext, { shouldSendNotificationToPM, shouldGetAuditRequestModelAfterEnterAudit: true, auditConfig: apiAuditConfig, accountId, projectId, requirementId });
|
|
200
|
+
|
|
201
|
+
// const auditEntities = await getAuditEntities(recordId, apiAuditConfig, auditorContext);
|
|
202
|
+
// const auditRequestModel = getAuditRequestModel(auditMetadata, auditEntities);
|
|
203
|
+
// const auditResponse = await submitAudit(auditRequestModel, auditorContext); // switched to this
|
|
204
|
+
//call getAuditRequestModelAfterEnterAudit and not the model itself
|
|
205
|
+
return submitAudit(auditRequestModel, auditorContext, { expectError });
|
|
206
|
+
// return submitAudit(accountId, projectId, requirementId, recordId, apiAuditConfig, auditorContext, { shouldSendNotificationToPM, dateStartedAudit, expectError });
|
|
190
207
|
|
|
191
|
-
const auditResponse = await submitAudit(auditRequestModel, auditorContext); // switched to this
|
|
192
208
|
// const auditResponse = await audit(auditRequestModel, auditorContext);
|
|
193
|
-
|
|
209
|
+
// if (auditResponse.status !== httpResponseStatusCodes.NO_CONTENT && !expectError) {
|
|
210
|
+
// throw new Error(`Failed to submit audit for record: ${recordId}. \n${auditResponse.status}`); //see what comes back
|
|
211
|
+
// }
|
|
212
|
+
|
|
213
|
+
// return auditResponse;
|
|
194
214
|
};
|
|
195
215
|
|
|
196
216
|
const getOnHoldModel = (auditId, onHoldReason) => {
|