@getjones/test-infra 2.7.14 → 2.7.15
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/factory/records/records.js +1 -1
- package/src/index.js +4 -2
- package/src/saas/internal-api/agreement/api/agreement.api.js +22 -0
- package/src/saas/internal-api/agreement/api/agreement.service.js +17 -0
- package/src/saas/internal-api/agreement/consts/consts.js +8 -0
- package/src/saas/internal-api/agreement/index.js +11 -0
- package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -0
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +19 -5
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +37 -43
- package/src/saas/internal-api/compliance/index.js +2 -4
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +2 -2
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -0
- package/src/saas/internal-api/compliance/utils/auditUtil.js +17 -6
- package/src/saas/openapi/tabs/index.js +6 -0
- package/src/saas/openapi/tabs/models/create.tab.model.js +6 -0
- package/src/saas/openapi/tabs/tabs.api.js +8 -3
- package/src/saas/openapi/tabs/tabs.service.js +6 -2
- package/src/saas/internal-api/compliance/consts/overrideGap.js +0 -10
- package/src/saas/internal-api/compliance/models/overrideGap/override.gap.model.js +0 -16
- package/src/saas/internal-api/compliance/models/overrideGap/retract.override.gap.model.js +0 -14
package/package.json
CHANGED
|
@@ -113,7 +113,7 @@ const prepareWaivedRecord = async (recordCompany, recordEmail, tabId, requiremen
|
|
|
113
113
|
const recordId = await prepareRecord(recordCompany, recordEmail, complianceStatuses.notCompliant, tabId, requirementId, context);
|
|
114
114
|
|
|
115
115
|
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
116
|
-
await compliance.services.overrideGap.
|
|
116
|
+
await compliance.services.overrideGap.waiveAll(record, context);
|
|
117
117
|
|
|
118
118
|
return recordId;
|
|
119
119
|
};
|
package/src/index.js
CHANGED
|
@@ -38,6 +38,7 @@ const getInternalAPI = () => {
|
|
|
38
38
|
|
|
39
39
|
const threadScheduler = require('./saas/internal-api/thread-scheduler/runner');
|
|
40
40
|
const dbEmails = require('./saas/internal-api/dbEmails/index');
|
|
41
|
+
const agreement = require('./saas/internal-api/agreement/index');
|
|
41
42
|
|
|
42
43
|
const internalAPI = {
|
|
43
44
|
defaults,
|
|
@@ -61,7 +62,8 @@ const getInternalAPI = () => {
|
|
|
61
62
|
requestsTable,
|
|
62
63
|
threadScheduler,
|
|
63
64
|
dbEmails,
|
|
64
|
-
factory
|
|
65
|
+
factory,
|
|
66
|
+
agreement
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
return internalAPI;
|
|
@@ -70,7 +72,7 @@ const getInternalAPI = () => {
|
|
|
70
72
|
const getOpenAPI = () => {
|
|
71
73
|
const accounts = require('./saas/openapi/accounts/accounts.service');
|
|
72
74
|
const projects = require('./saas/openapi/projects/projects.service');
|
|
73
|
-
const tabs = require('./saas/openapi/tabs
|
|
75
|
+
const tabs = require('./saas/openapi/tabs');
|
|
74
76
|
const requirements = require('./saas/openapi/requirements');
|
|
75
77
|
const requests = require('./saas/openapi/requests');
|
|
76
78
|
const coi = require('./saas/openapi/coi/coi.service');
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
create: `${backendUrl}/saas/contractor/agreement`,
|
|
6
|
+
delete: `${backendUrl}/saas/contractor/agreement`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const createAgreement = (createAgreementModel, context) => {
|
|
10
|
+
return requests.postRequestHandler(Endpoints.create, createAgreementModel, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const deleteAgreement = (recordId, context) => {
|
|
14
|
+
const headers = {};
|
|
15
|
+
const params = { contractorId: recordId };
|
|
16
|
+
return requests.deleteRequestHandler(Endpoints.delete, context, headers, params);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
createAgreement,
|
|
21
|
+
deleteAgreement
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const agreementAPI = require('./agreement.api');
|
|
2
|
+
const { CreateAgreementModel } = require('../models/create.agreement.model');
|
|
3
|
+
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
4
|
+
|
|
5
|
+
const createAgreement = (createAgreementModel, context) => {
|
|
6
|
+
validateType(createAgreementModel, CreateAgreementModel);
|
|
7
|
+
return agreementAPI.createAgreement(createAgreementModel, context);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const deleteAgreement = (recordId, context) => {
|
|
11
|
+
return agreementAPI.deleteAgreement(recordId, context);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
createAgreement,
|
|
16
|
+
deleteAgreement
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const createModel = require('./models/create.agreement.model');
|
|
2
|
+
const services = require('./api/agreement.service');
|
|
3
|
+
const agreementConsts = require('./consts/consts');
|
|
4
|
+
|
|
5
|
+
const models = { create: createModel };
|
|
6
|
+
|
|
7
|
+
const consts = {
|
|
8
|
+
audit: agreementConsts
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = { services, models, consts };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { UPLOADER_TYPE } = require('../consts/consts');
|
|
2
|
+
|
|
3
|
+
class CreateAgreementModel {
|
|
4
|
+
constructor({ contractorId, contractorDateModified, uploaderId, signedContractName, uploaderType = UPLOADER_TYPE.USER }) {
|
|
5
|
+
this.contractorId = contractorId;
|
|
6
|
+
this.contractorDateModified = contractorDateModified;
|
|
7
|
+
this.uploaderId = uploaderId;
|
|
8
|
+
this.signedContractName = signedContractName;
|
|
9
|
+
this.uploaderType = uploaderType;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
module.exports = { CreateAgreementModel };
|
|
@@ -2,18 +2,32 @@ const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
|
2
2
|
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
3
|
|
|
4
4
|
const Endpoints = {
|
|
5
|
+
waive: contractorId => `${backendUrl}/saas/contractors/${contractorId}/waiver`,
|
|
6
|
+
retract: contractorId => `${backendUrl}/saas/contractors/${contractorId}/waiver`,
|
|
5
7
|
overrideGap: `${backendUrl}/saas/record/override-gap`,
|
|
6
8
|
retractOverride: `${backendUrl}/saas/record/retract-override`
|
|
7
9
|
};
|
|
8
10
|
|
|
9
|
-
const
|
|
11
|
+
const waive = async (contractorId, waiveRequestModel, context) => {
|
|
12
|
+
const status = waiveRequestModel.status;
|
|
13
|
+
delete waiveRequestModel.status;
|
|
14
|
+
return requests.postRequestHandler(Endpoints.waive(contractorId), waiveRequestModel, context, {}, { status });
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const retract = async (contractorId, retractRequestModel, context) => {
|
|
18
|
+
const status = retractRequestModel.status;
|
|
19
|
+
delete retractRequestModel.status;
|
|
20
|
+
return requests.postRequestHandler(Endpoints.retract(contractorId), retractRequestModel, context, {}, { status });
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const overrideGap = ({ waiveRequestModel, isTestingBackwardCompatibility = false, context }) => {
|
|
10
24
|
const headers = {};
|
|
11
25
|
const params = { isTestingBackwardCompatibility };
|
|
12
|
-
return requests.postRequestHandler(Endpoints.overrideGap,
|
|
26
|
+
return requests.postRequestHandler(Endpoints.overrideGap, waiveRequestModel, context, headers, params);
|
|
13
27
|
};
|
|
14
28
|
|
|
15
|
-
const retractOverride = (
|
|
16
|
-
return requests.postRequestHandler(Endpoints.retractOverride,
|
|
29
|
+
const retractOverride = (retractRequestModel, context) => {
|
|
30
|
+
return requests.postRequestHandler(Endpoints.retractOverride, retractRequestModel, context);
|
|
17
31
|
};
|
|
18
32
|
|
|
19
|
-
module.exports = { overrideGap, retractOverride };
|
|
33
|
+
module.exports = { waive, retract, overrideGap, retractOverride };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
const env = require('../../../../../env');
|
|
2
2
|
|
|
3
3
|
const overrideGapApi = require('./override.gap.api');
|
|
4
|
-
const {
|
|
5
|
-
const { RetractOverrideGapModel } = require('../../models/overrideGap/retract.override.gap.model');
|
|
6
|
-
const { OVERRIDE_GAP_REASONS } = require('../../consts/overrideGap');
|
|
4
|
+
const { WaiveRequestModel, RetractRequestModel, WAIVER_REASONS } = require('../../models/waive/waive.model');
|
|
7
5
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
8
6
|
const auditUtil = require('../../utils/auditUtil');
|
|
9
7
|
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
@@ -11,21 +9,31 @@ const httpResponseStatusCodes = require('../../../../../common/httpResponseStatu
|
|
|
11
9
|
const { credentials } = env.getEnv();
|
|
12
10
|
const userTypes = require('../../../../../common/consts/userTypes');
|
|
13
11
|
|
|
14
|
-
const
|
|
15
|
-
validateType(
|
|
16
|
-
return overrideGapApi.
|
|
12
|
+
const waive = (waiveRequestModel, context) => {
|
|
13
|
+
validateType(waiveRequestModel, WaiveRequestModel);
|
|
14
|
+
return overrideGapApi.waive(waiveRequestModel.contractorId, waiveRequestModel, context);
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
const
|
|
20
|
-
validateType(
|
|
21
|
-
return overrideGapApi.
|
|
17
|
+
const retract = (retractRequestModel, context) => {
|
|
18
|
+
validateType(retractRequestModel, RetractRequestModel);
|
|
19
|
+
return overrideGapApi.retract(retractRequestModel.contractorId, retractRequestModel, context);
|
|
22
20
|
};
|
|
23
21
|
|
|
24
|
-
const
|
|
22
|
+
const overrideGap = ({ waiveRequestModel, isTestingBackwardCompatibility = false, context }) => {
|
|
23
|
+
validateType(waiveRequestModel, WaiveRequestModel);
|
|
24
|
+
return overrideGapApi.overrideGap({ waiveRequestModel, isTestingBackwardCompatibility, context });
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const retractOverride = (retractRequestModel, context) => {
|
|
28
|
+
validateType(retractRequestModel, RetractRequestModel);
|
|
29
|
+
return overrideGapApi.retractOverride(retractRequestModel, context);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const getWaiveModel = (
|
|
25
33
|
record,
|
|
26
34
|
policyName,
|
|
27
35
|
attributeName,
|
|
28
|
-
|
|
36
|
+
waiverReason,
|
|
29
37
|
remarks,
|
|
30
38
|
{
|
|
31
39
|
userId,
|
|
@@ -35,19 +43,19 @@ const getOverrideGapModel = (
|
|
|
35
43
|
userId = userId || env.getSystemUserIdentity(credentials.superUser).id;
|
|
36
44
|
userRole = userRole || userTypes.ICS;
|
|
37
45
|
|
|
38
|
-
const
|
|
46
|
+
const waiveModel = new WaiveRequestModel({
|
|
39
47
|
contractorId: record.id,
|
|
40
48
|
auditId,
|
|
41
|
-
|
|
49
|
+
waiverReason,
|
|
42
50
|
remarks,
|
|
43
51
|
userId,
|
|
44
52
|
userRole
|
|
45
53
|
});
|
|
46
54
|
|
|
47
|
-
return
|
|
55
|
+
return waiveModel;
|
|
48
56
|
};
|
|
49
57
|
|
|
50
|
-
const
|
|
58
|
+
const getWaiveModelByGap = (
|
|
51
59
|
record,
|
|
52
60
|
policyName,
|
|
53
61
|
gap,
|
|
@@ -59,7 +67,7 @@ const getOverrideGapModelByGap = (
|
|
|
59
67
|
} = {}) => {
|
|
60
68
|
const attributeName = auditUtil.getAttributeNameByGap(record, policyName, gap);
|
|
61
69
|
|
|
62
|
-
return
|
|
70
|
+
return getWaiveModel(record, policyName, attributeName, reason, note, { userId, userRole });
|
|
63
71
|
};
|
|
64
72
|
|
|
65
73
|
const getRetractModel = (record, policyName, attributeName) => {
|
|
@@ -67,7 +75,7 @@ const getRetractModel = (record, policyName, attributeName) => {
|
|
|
67
75
|
const userId = env.getSystemUserIdentity(credentials.superUser).id;
|
|
68
76
|
const userRole = userTypes.ICS;
|
|
69
77
|
|
|
70
|
-
const retractModel = new
|
|
78
|
+
const retractModel = new RetractRequestModel({
|
|
71
79
|
contractorId: record.id,
|
|
72
80
|
auditId,
|
|
73
81
|
userId,
|
|
@@ -94,40 +102,26 @@ const getPolicyAuditIdFromRecord = (record, policyName, attributeName) => {
|
|
|
94
102
|
return attribute.auditId;
|
|
95
103
|
};
|
|
96
104
|
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
const allOverriddenPolicies = auditUtil.getAllOverriddenGapPolicies(record, context);
|
|
105
|
+
const waiveAll = async (record, context, { reason = WAIVER_REASONS.BUSINESS_DECISION, note = 'WAIVED AUTOMATICALLY' } = {}) => {
|
|
106
|
+
const allWaivablePolicies = auditUtil.getAllWaivablePolicies(record, context);
|
|
100
107
|
|
|
101
|
-
for (const
|
|
102
|
-
const
|
|
103
|
-
const
|
|
108
|
+
for (const waivable of allWaivablePolicies) {
|
|
109
|
+
const waiveModel = getWaiveModel(record, waivable.policyName, waivable.attributeName, reason, note);
|
|
110
|
+
const waiveResponse = await waive(waiveModel, context);
|
|
104
111
|
|
|
105
|
-
if (
|
|
106
|
-
throw Error(`Failed to
|
|
112
|
+
if (waiveResponse.status !== httpResponseStatusCodes.OK) {
|
|
113
|
+
throw Error(`Failed to waive ${waivable.policyName} - ${waivable.attributeName} for ${record.company}`);
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
};
|
|
110
117
|
|
|
111
|
-
const waiveAllGaps = async (record, context, { reason = OVERRIDE_GAP_REASONS.BUSINESS_DECISION, note = 'WAIVED AUTOMATICALLY' } = {}) => {
|
|
112
|
-
const waivedReasons = new Set([OVERRIDE_GAP_REASONS.BUSINESS_DECISION, OVERRIDE_GAP_REASONS.EXECUTIVE_APPROVAL, OVERRIDE_GAP_REASONS.NO_EXPOSURE]);
|
|
113
|
-
|
|
114
|
-
if (!waivedReasons.has(reason)) {
|
|
115
|
-
throw Error(`Invalid waive reason ${reason} provided when trying to waive all gaps to waive`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
await overrideAllGaps(record, context, { reason, note });
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const acceptAllGaps = async (record, context, { note = 'ACCEPTED AUTOMATICALLY' } = {}) => {
|
|
122
|
-
overrideAllGaps(record, context, { reason: OVERRIDE_GAP_REASONS.ACCEPT_NO_EXPOSURE, note });
|
|
123
|
-
};
|
|
124
|
-
|
|
125
118
|
module.exports = {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
waive,
|
|
120
|
+
waiveAll,
|
|
121
|
+
retract,
|
|
122
|
+
getWaiveModel,
|
|
129
123
|
getRetractModel,
|
|
130
|
-
|
|
124
|
+
getWaiveModelByGap,
|
|
131
125
|
overrideGap,
|
|
132
126
|
retractOverride
|
|
133
127
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
const auditModels = require('./models/audit/audit.model');
|
|
2
2
|
const auditServices = require('./api/audit/audit.service');
|
|
3
3
|
|
|
4
|
-
const waiveModels = require('./models/
|
|
4
|
+
const waiveModels = require('./models/waive/waive.model');
|
|
5
5
|
const overrideGapServices = require('./api/overrideGap/override.gap.service');
|
|
6
6
|
|
|
7
7
|
const convertServices = require('./api/convert/convert.service');
|
|
8
8
|
const coverageServices = require('./api/coverage/coverage.service');
|
|
9
9
|
|
|
10
10
|
const auditConsts = require('./consts/audit');
|
|
11
|
-
const overrideGapConsts = require('./consts/overrideGap');
|
|
12
11
|
const auditUtils = require('./utils/auditUtil');
|
|
13
12
|
|
|
14
13
|
const models = {
|
|
@@ -17,8 +16,7 @@ const models = {
|
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
const consts = {
|
|
20
|
-
audit: auditConsts
|
|
21
|
-
overrideGap: overrideGapConsts
|
|
19
|
+
audit: auditConsts
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
const utils = {
|
|
@@ -59,7 +59,7 @@ class AuditDatesModel {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
class AuditListParametersModel {
|
|
62
|
-
constructor(page, accountIds, { fromDate, toDate } = {}) {
|
|
62
|
+
constructor(page, accountIds, { fromDate, toDate, recordId } = {}) {
|
|
63
63
|
validateInteger(page, { min: 1 });
|
|
64
64
|
validateArray(accountIds);
|
|
65
65
|
|
|
@@ -72,7 +72,7 @@ class AuditListParametersModel {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
this.page = page;
|
|
75
|
-
this.filters = { accountIds, fromDate, toDate };
|
|
75
|
+
this.filters = { accountIds, fromDate, toDate, recordId };
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const WAIVE_ACTIONS = {
|
|
2
|
+
WAIVE: 'ignored',
|
|
3
|
+
RETRACT: 'notIgnored'
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const WAIVER_REASONS = {
|
|
7
|
+
BUSINESS_DECISION: 'Business Decision',
|
|
8
|
+
EXECUTIVE_APPROVAL: 'Executive Approval',
|
|
9
|
+
ACCEPT_NO_EXPOSURE: 'Accept / No Exposure',
|
|
10
|
+
NO_EXPOSURE: 'No Exposure' // DEPRECATED - BACKWARD COMPATIBILITY
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function WaiveRequestModel({
|
|
14
|
+
contractorId,
|
|
15
|
+
auditId,
|
|
16
|
+
waiverReason,
|
|
17
|
+
remarks,
|
|
18
|
+
userId,
|
|
19
|
+
userRole
|
|
20
|
+
}) {
|
|
21
|
+
this.auditorContractorId = auditId;
|
|
22
|
+
this.contractorId = contractorId;
|
|
23
|
+
this.waiverReason = waiverReason;
|
|
24
|
+
this.remarks = remarks || '';
|
|
25
|
+
|
|
26
|
+
this.userId = userId,
|
|
27
|
+
this.userRole = userRole,
|
|
28
|
+
this.status = WAIVE_ACTIONS.WAIVE;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function RetractRequestModel({
|
|
32
|
+
contractorId,
|
|
33
|
+
auditId,
|
|
34
|
+
userId,
|
|
35
|
+
userRole
|
|
36
|
+
}) {
|
|
37
|
+
this.auditorContractorId = auditId;
|
|
38
|
+
this.contractorId = contractorId;
|
|
39
|
+
this.userId = userId;
|
|
40
|
+
this.userRole = userRole;
|
|
41
|
+
this.status = WAIVE_ACTIONS.RETRACT;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
WaiveRequestModel,
|
|
46
|
+
RetractRequestModel,
|
|
47
|
+
WAIVE_ACTIONS,
|
|
48
|
+
WAIVER_REASONS
|
|
49
|
+
};
|
|
@@ -2,7 +2,7 @@ const { AUDIT_ENTITY_STATUSES, DEFAULT_POLICY_ID, VALID_SCORES } = require('../c
|
|
|
2
2
|
const { isObject, isArray } = require('../../../../common/utils/dataTypeUtils');
|
|
3
3
|
const timeUtils = require('../../../../common/utils/timeUtils');
|
|
4
4
|
const auditModels = require('../models/audit/audit.model');
|
|
5
|
-
const
|
|
5
|
+
const waiveModels = require('../models/waive/waive.model');
|
|
6
6
|
|
|
7
7
|
const emptyValue = '';
|
|
8
8
|
|
|
@@ -22,6 +22,10 @@ const getAttributeKey = attribute => {
|
|
|
22
22
|
return specialAttributes[attribute] || attribute;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
const getWaiveReason = reason => {
|
|
26
|
+
return waiveReasons[reason] || reason;
|
|
27
|
+
};
|
|
28
|
+
|
|
25
29
|
const getAttributeNameByGap = function(record, policyName, gap) {
|
|
26
30
|
const policy = record.reviewbyAuditor.find(contractorCoverage =>
|
|
27
31
|
contractorCoverage.insuranceName === policyName);
|
|
@@ -39,8 +43,8 @@ const getAttributeNameByGap = function(record, policyName, gap) {
|
|
|
39
43
|
return attribute.limitname;
|
|
40
44
|
};
|
|
41
45
|
|
|
42
|
-
const
|
|
43
|
-
const
|
|
46
|
+
const getAllWaivablePolicies = function(record) {
|
|
47
|
+
const waivable = [];
|
|
44
48
|
|
|
45
49
|
const policies = record.reviewbyAuditor;
|
|
46
50
|
for (const policy of policies) {
|
|
@@ -51,7 +55,7 @@ const getAllOverriddenGapPolicies = function(record) {
|
|
|
51
55
|
|
|
52
56
|
for (const error of errorList) {
|
|
53
57
|
if (error.warningStatus === 'POLICYERROR' && error.errorStatus === 'notIgnored') {
|
|
54
|
-
|
|
58
|
+
waivable.push({
|
|
55
59
|
policyName: policyName,
|
|
56
60
|
attributeName: error.limitname
|
|
57
61
|
});
|
|
@@ -59,7 +63,7 @@ const getAllOverriddenGapPolicies = function(record) {
|
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
return
|
|
66
|
+
return waivable;
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
const getPolicyId = (policyName, requirement) => {
|
|
@@ -172,7 +176,8 @@ module.exports = {
|
|
|
172
176
|
createAuditEntity,
|
|
173
177
|
getAttributeKey,
|
|
174
178
|
getAttributeNameByGap,
|
|
175
|
-
|
|
179
|
+
getWaiveReason,
|
|
180
|
+
getAllWaivablePolicies
|
|
176
181
|
};
|
|
177
182
|
|
|
178
183
|
const certificateEndorsmentsList = [
|
|
@@ -209,3 +214,9 @@ const specialAttributes = {
|
|
|
209
214
|
'Umbrella': 'UMoccur'
|
|
210
215
|
}
|
|
211
216
|
};
|
|
217
|
+
|
|
218
|
+
const waiveReasons = {
|
|
219
|
+
'No Exposure': waiveModels.WAIVER_REASONS.NO_EXPOSURE,
|
|
220
|
+
'Business Decision': waiveModels.WAIVER_REASONS.BUSINESS_DECISION,
|
|
221
|
+
'Executive Approval': waiveModels.WAIVER_REASONS.EXECUTIVE_APPROVAL
|
|
222
|
+
};
|
|
@@ -3,11 +3,16 @@ const { openapiUrl, backendUrl } = require('../../../env').getEnv();
|
|
|
3
3
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
delete: tabId => `${openapiUrl}/tabs/${tabId}`,
|
|
6
|
-
get: tabId => `${backendUrl}/tabs/${tabId}
|
|
6
|
+
get: tabId => `${backendUrl}/tabs/${tabId}`,
|
|
7
|
+
create: projectId => `${openapiUrl}/properties/${projectId}/tab`
|
|
7
8
|
};
|
|
8
9
|
|
|
9
|
-
const deleteTabById =
|
|
10
|
+
const deleteTabById = (tabId, apiKey) => {
|
|
10
11
|
return requests.deleteRequestHandler(Endpoints.delete(tabId), apiKey);
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
const createTab = (projectId, createTabModel, apiKey) => {
|
|
15
|
+
return requests.postRequestHandler(Endpoints.create(projectId), apiKey, createTabModel);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = { deleteTabById, createTab };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
const tabsApi = require('./tabs.api');
|
|
2
2
|
|
|
3
|
-
const deleteTabById =
|
|
3
|
+
const deleteTabById = (tabId, apiKey) => {
|
|
4
4
|
return tabsApi.deleteTabById(tabId, apiKey);
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const createTab = (projectId, createTabModel, apiKey) => {
|
|
8
|
+
return tabsApi.createTab(projectId, createTabModel, apiKey);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = { deleteTabById, createTab };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const OVERRIDE_GAP_REASONS = {
|
|
2
|
-
BUSINESS_DECISION: 'Business Decision',
|
|
3
|
-
EXECUTIVE_APPROVAL: 'Executive Approval',
|
|
4
|
-
ACCEPT_NO_EXPOSURE: 'Accept / No Exposure',
|
|
5
|
-
NO_EXPOSURE: 'No Exposure' // DEPRECATED - BACKWARD COMPATIBILITY
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
OVERRIDE_GAP_REASONS
|
|
10
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class OverrideGapModel {
|
|
2
|
-
constructor({
|
|
3
|
-
contractorId, auditId, reason, remarks, userId, userRole
|
|
4
|
-
}) {
|
|
5
|
-
this.auditorContractorId = auditId;
|
|
6
|
-
this.contractorId = contractorId;
|
|
7
|
-
this.reason = reason;
|
|
8
|
-
this.remarks = remarks || '';
|
|
9
|
-
this.userId = userId;
|
|
10
|
-
this.userRole = userRole;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
OverrideGapModel
|
|
16
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
class RetractOverrideGapModel {
|
|
2
|
-
constructor({
|
|
3
|
-
contractorId, auditId, userId, userRole
|
|
4
|
-
}) {
|
|
5
|
-
this.auditorContractorId = auditId;
|
|
6
|
-
this.contractorId = contractorId;
|
|
7
|
-
this.userId = userId;
|
|
8
|
-
this.userRole = userRole;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
RetractOverrideGapModel
|
|
14
|
-
};
|