@getjones/test-infra 1.2.2 → 1.2.3
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/compliance/api/audit/audit.api.js +2 -2
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +3 -3
- package/src/saas/internal-api/compliance/api/coverage/coverage.setup.js +2 -2
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +51 -32
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ const { backendUrl } = require('../../../../../env').getEnv();
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
auditorContractorList: `${backendUrl}/saas/auditor/contractors`,
|
|
6
6
|
preAudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/master-audit`,
|
|
7
|
-
audit:
|
|
7
|
+
audit: `${backendUrl}/saas/auditor/contractors/submit/audits`,
|
|
8
8
|
contractorDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/master-audit`,
|
|
9
9
|
requirementDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractor/${contractorId}/requirement`
|
|
10
10
|
};
|
|
@@ -15,7 +15,7 @@ const getAuditorContractorList = (page, accountId, context) => {
|
|
|
15
15
|
|
|
16
16
|
const audit = async (contractorId, auditRequestModel, context) => {
|
|
17
17
|
const response = await requests.getRequestHandler(Endpoints.preAudit(contractorId), {}, context);
|
|
18
|
-
return requests.postRequestHandler(Endpoints.audit
|
|
18
|
+
return requests.postRequestHandler(Endpoints.audit, auditRequestModel, context).then(res => res.data);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const getContractorDetailsForAudit = (contractorId, context) => {
|
|
@@ -4,7 +4,7 @@ const { backendUrl, nodeBackendUrl } = require('../../../../../env').getEnv();
|
|
|
4
4
|
|
|
5
5
|
const Endpoints = {
|
|
6
6
|
saveCoverageNode: `${nodeBackendUrl}/coverage`,
|
|
7
|
-
saveCoverageJava:
|
|
7
|
+
saveCoverageJava: `${backendUrl}/saas/contractors/coverage`,
|
|
8
8
|
getCoverageByCoiId: coiId => `${nodeBackendUrl}/coverage/${coiId}`
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -12,8 +12,8 @@ const saveCoverageNode = (coverage, nodeBackendSecret) => {
|
|
|
12
12
|
return openApiRequests.postRequestHandler(Endpoints.saveCoverageNode, nodeBackendSecret, coverage);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const saveCoverageJava = (auditorContext,
|
|
16
|
-
return internalApiRequests.postRequestHandler(Endpoints.saveCoverageJava
|
|
15
|
+
const saveCoverageJava = (auditorContext, auditDates, coverage) => {
|
|
16
|
+
return internalApiRequests.postRequestHandler(Endpoints.saveCoverageJava, { auditDates, coverage }, auditorContext);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const getCoverageByCoiId = (coiId, nodeBackendSecret) => {
|
|
@@ -4,8 +4,8 @@ const saveCoverageNode = async (coverage, nodeBackendSecret) => {
|
|
|
4
4
|
return coverageApi.saveCoverageNode(coverage, nodeBackendSecret);
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
const saveCoverageJava = async (auditorContext,
|
|
8
|
-
return coverageApi.saveCoverageJava(auditorContext,
|
|
7
|
+
const saveCoverageJava = async (auditorContext, auditDates, coverage) => {
|
|
8
|
+
return coverageApi.saveCoverageJava(auditorContext, auditDates, coverage);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const getCoverageByCoiId = async (coiId, nodeBackendSecret) => {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
2
|
+
|
|
1
3
|
const COI_AUDIT_STATUSES = {
|
|
2
4
|
NOT_AUDITED: '0',
|
|
3
5
|
REAUDIT: '3'
|
|
@@ -21,50 +23,67 @@ const AUDIT_POLICY_NAMES = {
|
|
|
21
23
|
|
|
22
24
|
const AUDITOR_ROLE = 'Auditor';
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
26
|
+
class AuditRequestModel{
|
|
27
|
+
constructor(
|
|
28
|
+
accountId = null,
|
|
29
|
+
projectId = null,
|
|
30
|
+
requirementId = null,
|
|
31
|
+
contractorId = null,
|
|
32
|
+
certificateId = null,
|
|
33
|
+
auditorId = null,
|
|
34
|
+
auditEntities = null,
|
|
35
|
+
isReaudit = null,
|
|
36
|
+
isProjectOnboarding = false,
|
|
37
|
+
shouldSendNotificationToPM = true,
|
|
38
|
+
auditDates = {},
|
|
39
|
+
auditStatus = null,
|
|
40
|
+
auditorRole = AUDITOR_ROLE,
|
|
41
|
+
){
|
|
42
|
+
const auditData = {
|
|
43
|
+
userId: accountId,
|
|
44
|
+
projectId: projectId,
|
|
45
|
+
requirementId: requirementId,
|
|
46
|
+
contractorId: contractorId,
|
|
47
|
+
certificateId: certificateId,
|
|
48
|
+
auditorId: auditorId,
|
|
49
|
+
policyDetails: auditEntities,
|
|
50
|
+
auditorStatus: COI_AUDIT_STATUSES.NOT_AUDITED,
|
|
51
|
+
isReaudit: isReaudit,
|
|
52
|
+
projectOnboarding: isProjectOnboarding,
|
|
53
|
+
role: auditorRole,
|
|
54
|
+
sendNotificationToPM: shouldSendNotificationToPM,
|
|
55
|
+
auditStatus
|
|
56
|
+
};
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
validateType(auditDates,AuditDatesModel)
|
|
59
|
+
this.auditData = auditData;
|
|
60
|
+
this.auditDates = auditDates
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
class AuditEntityModel {
|
|
65
|
+
constructor(policyId, attributeName, status, value){
|
|
59
66
|
this.contractorInsuranceId = policyId;
|
|
60
67
|
this.limitname = attributeName;
|
|
61
68
|
this.status = status;
|
|
62
69
|
this.value = value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class AuditDatesModel{
|
|
74
|
+
constructor(contractorId ,contractorDateModified, dateStartedAudit, contractorOverrideDateModified, contractCreateDate){
|
|
75
|
+
this.contractorId = contractorId;
|
|
76
|
+
this.contractorDateModified = contractorDateModified;
|
|
77
|
+
this.dateStartedAudit = dateStartedAudit;
|
|
78
|
+
this.contractorOverrideDateModified = contractorOverrideDateModified;
|
|
79
|
+
this.contractCreateDate = contractCreateDate;
|
|
80
|
+
}
|
|
63
81
|
}
|
|
64
82
|
|
|
65
83
|
module.exports = {
|
|
66
84
|
AuditRequestModel,
|
|
67
85
|
AuditEntityModel,
|
|
86
|
+
AuditDatesModel,
|
|
68
87
|
COI_AUDIT_STATUSES,
|
|
69
88
|
AUDIT_ENTITY_STATUSES,
|
|
70
89
|
AUDIT_ATTRIBUTE_NAMES,
|