@getjones/test-infra 2.5.0 → 2.6.1
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 +30 -30
- package/src/common/commonFlows/index.js +3 -3
- package/src/common/commonFlows/records/records.js +71 -71
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/requests/apiKeyAuth/requests.js +38 -38
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/requestHandlers.js +60 -60
- package/src/common/utils/dataTypeUtils.js +41 -41
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/objectUtils.js +9 -9
- package/src/common/utils/timeUtils.js +171 -171
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/auditConfigs.js +85 -85
- package/src/defaults/configs/polices.js +47 -47
- package/src/defaults/configs/requirement.js +29 -29
- package/src/defaults/index.js +5 -5
- package/src/env.js +57 -57
- package/src/index.js +73 -73
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +28 -28
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +77 -77
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +24 -24
- package/src/saas/internal-api/accounts/consts/consts.js +6 -6
- package/src/saas/internal-api/accounts/index.js +21 -21
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +23 -23
- package/src/saas/internal-api/accounts/utils/utils.js +32 -32
- package/src/saas/internal-api/auth/api/auth.api.js +18 -18
- package/src/saas/internal-api/auth/api/auth.service.js +67 -67
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +34 -34
- package/src/saas/internal-api/coi/api/coi.service.js +22 -22
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +7 -7
- package/src/saas/internal-api/coi/index.js +13 -13
- package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
- package/src/saas/internal-api/coi/utils/utils.js +48 -48
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +40 -40
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +151 -151
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +24 -24
- package/src/saas/internal-api/compliance/api/waive/waive.api.js +21 -21
- package/src/saas/internal-api/compliance/api/waive/waive.service.js +15 -15
- package/src/saas/internal-api/compliance/consts/audit.js +81 -81
- package/src/saas/internal-api/compliance/index.js +28 -28
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +84 -84
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +45 -45
- package/src/saas/internal-api/compliance/utils/util.js +175 -175
- package/src/saas/internal-api/contractors/api/contractors.api.js +141 -141
- package/src/saas/internal-api/contractors/api/contractors.service.js +147 -123
- package/src/saas/internal-api/contractors/index.js +8 -8
- package/src/saas/internal-api/contractors/models/create.contractor.model.js +22 -22
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +60 -60
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
- package/src/saas/internal-api/dashboardInnerPage/api/recordList.api.js +12 -12
- package/src/saas/internal-api/dashboardInnerPage/api/recordList.service.js +7 -7
- package/src/saas/internal-api/dashboardInnerPage/index.js +5 -5
- package/src/saas/internal-api/dashboardInnerPage/models/dashboard.filter.criteria.model.js +38 -38
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +127 -127
- package/src/saas/internal-api/dbEmails/consts/consts.js +3 -3
- package/src/saas/internal-api/dbEmails/index.js +4 -4
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +21 -21
- package/src/saas/internal-api/dbEmails/utils/util.js +59 -59
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +76 -76
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +83 -83
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +43 -43
- package/src/saas/internal-api/globalRecord/utils/util.js +148 -148
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +17 -17
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +39 -39
- package/src/saas/internal-api/projects/utils/utils.js +82 -82
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +29 -29
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/reports/api/reports.api.js +39 -39
- package/src/saas/internal-api/reports/api/reports.service.js +34 -34
- package/src/saas/internal-api/reports/consts/consts.js +63 -63
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +54 -54
- package/src/saas/internal-api/requests/api/requests.service.js +51 -51
- package/src/saas/internal-api/requests/index.js +14 -14
- package/src/saas/internal-api/requests/models/create.request.model.js +22 -22
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
- package/src/saas/internal-api/requests/utils.js +8 -8
- package/src/saas/internal-api/requirements/api/requirements.api.js +45 -45
- package/src/saas/internal-api/requirements/api/requirements.service.js +94 -94
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +5 -5
- package/src/saas/internal-api/requirements/consts/consts.js +6 -6
- package/src/saas/internal-api/requirements/index.js +8 -8
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
- package/src/saas/internal-api/requirements/models/policy.model.js +32 -32
- package/src/saas/internal-api/requirements/models/update.requirement.model.js +21 -21
- package/src/saas/internal-api/requirements/utils/utils.js +101 -101
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +18 -18
- package/src/saas/internal-api/thread-scheduler/runner.js +39 -13
- package/src/saas/internal-api/users/api/users.api.js +77 -77
- package/src/saas/internal-api/users/api/users.service.js +101 -101
- package/src/saas/internal-api/users/index.js +4 -4
- package/src/saas/internal-api/users/models/users.model.js +31 -31
- package/src/saas/internal-api/users/utils/util.js +14 -14
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/projects/projects.api.js +59 -59
- package/src/saas/openapi/projects/projects.service.js +44 -44
- package/src/saas/openapi/requests/index.js +6 -6
- package/src/saas/openapi/requests/models/invite.request.model.js +37 -37
- package/src/saas/openapi/requests/requests.api.js +20 -20
- package/src/saas/openapi/requests/requests.service.js +18 -18
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +12 -12
- package/src/saas/openapi/requirements/requirements.service.js +20 -20
- package/src/saas/openapi/tabs/tabs.api.js +13 -13
- package/src/saas/openapi/tabs/tabs.service.js +7 -7
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
|
@@ -1,175 +1,175 @@
|
|
|
1
|
-
const { AUDIT_ENTITY_STATUSES, DEFAULT_POLICY_ID, VALID_SCORES } = require('../consts/audit');
|
|
2
|
-
const { isObject, isArray } = require('../../../../common/utils/dataTypeUtils');
|
|
3
|
-
const timeUtils = require('../../../../common/utils/timeUtils');
|
|
4
|
-
const auditModels = require('../models/audit/audit.model');
|
|
5
|
-
const { getEnv, getSystemUserIdentity } = require('../../../../env');
|
|
6
|
-
const { credentials } = getEnv();
|
|
7
|
-
|
|
8
|
-
const emptyValue = '';
|
|
9
|
-
|
|
10
|
-
const getValueBySelection = selection => {
|
|
11
|
-
return ['Yes', 'No', 'Empty', 'Claims'].includes(selection) ? emptyValue : selection;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const getDateInApiFormat = date => {
|
|
15
|
-
return timeUtils.convertDateToNewFormat(
|
|
16
|
-
date,
|
|
17
|
-
timeUtils.formats.dayMonthYear,
|
|
18
|
-
timeUtils.formats.numericMonthDayYear
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const getAttributeKey = attribute => {
|
|
23
|
-
return specialAttributes[attribute] || attribute;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const getPolicyId = (policyName, requirement) => {
|
|
27
|
-
if (!policyName || policyName === 'Certificate of Insurance') {
|
|
28
|
-
return DEFAULT_POLICY_ID;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const policy = requirement.policies.find(policy => policy.name === policyName);
|
|
32
|
-
|
|
33
|
-
if (!policy) {
|
|
34
|
-
let policiesList = emptyValue;
|
|
35
|
-
requirement.policies.forEach(policy => policiesList += `${policy.name},`);
|
|
36
|
-
|
|
37
|
-
throw Error(`Policy '${policyName}' not found in the Requirement. List: ${policiesList.slice(0, -1)}`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return policy.id;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const getParsedConfig = function(config) {
|
|
44
|
-
const auditDataArr = [];
|
|
45
|
-
for (const field in config) {
|
|
46
|
-
if (!config.hasOwnProperty(field)) {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (isObject(config[field])) {
|
|
51
|
-
const attributes = config[field];
|
|
52
|
-
for (const attributeName in attributes) {
|
|
53
|
-
if (attributeName === 'Policy Expiry') {
|
|
54
|
-
attributes[attributeName] = getDateInApiFormat(attributes[attributeName]);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const selection = { policyName: field };
|
|
58
|
-
|
|
59
|
-
// Special attribute names switch
|
|
60
|
-
switch (attributeName) {
|
|
61
|
-
case 'Occur':
|
|
62
|
-
const occurKeys = getAttributeKey(attributeName);
|
|
63
|
-
selection.attributeName = occurKeys[field];
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
selection.attributeName = getAttributeKey(attributeName);
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (isArray(attributes[attributeName])) {
|
|
71
|
-
selection.status = AUDIT_ENTITY_STATUSES[ (attributes[attributeName][0]).toUpperCase() ];
|
|
72
|
-
selection.value = attributes[attributeName][1].replace('$', emptyValue);
|
|
73
|
-
} else {
|
|
74
|
-
// Special statuses switch
|
|
75
|
-
switch (selection.attributeName) {
|
|
76
|
-
case getAttributeKey('Policy Number'):
|
|
77
|
-
selection.status = emptyValue;
|
|
78
|
-
break;
|
|
79
|
-
case getAttributeKey('Policy Expiry'):
|
|
80
|
-
selection.status = AUDIT_ENTITY_STATUSES.YES;
|
|
81
|
-
break;
|
|
82
|
-
default:
|
|
83
|
-
selection.status = AUDIT_ENTITY_STATUSES[ (attributes[attributeName]).toUpperCase() ];
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
selection.value = getValueBySelection(attributes[attributeName]);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
auditDataArr.push(selection);
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
if (field === 'Certificate issue date') {
|
|
94
|
-
config[field] = getDateInApiFormat(config[field]);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const selection = { attributeName: getAttributeKey(field) };
|
|
98
|
-
certificateEndorsmentsList.includes(field) && (selection.policyName = field);
|
|
99
|
-
|
|
100
|
-
if (isArray(config[field])) {
|
|
101
|
-
selection.status = AUDIT_ENTITY_STATUSES[ (config[field][0]).toUpperCase() ];
|
|
102
|
-
selection.value = config[field][1]; // Ok to be undefined
|
|
103
|
-
} else {
|
|
104
|
-
selection.status = AUDIT_ENTITY_STATUSES[ (config[field]).toUpperCase() ] || AUDIT_ENTITY_STATUSES.YES;
|
|
105
|
-
selection.value = getValueBySelection(config[field]);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (field === 'AM Score') {
|
|
109
|
-
selection.status = VALID_SCORES.includes(selection.value) ? AUDIT_ENTITY_STATUSES.YES : AUDIT_ENTITY_STATUSES.NO;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
auditDataArr.push(selection);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return auditDataArr;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const createAuditEntity = (
|
|
119
|
-
requirement, {
|
|
120
|
-
policyName = null,
|
|
121
|
-
attributeName = null,
|
|
122
|
-
value = emptyValue,
|
|
123
|
-
status = emptyValue
|
|
124
|
-
}) => {
|
|
125
|
-
const policyId = getPolicyId(policyName, requirement);
|
|
126
|
-
const auditEntityModel = new auditModels.AuditEntityModel(policyId, attributeName, status, value);
|
|
127
|
-
return auditEntityModel;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const getAuditorId = () => {
|
|
131
|
-
const auditorIdentity = getSystemUserIdentity(credentials.auditorUser);
|
|
132
|
-
return auditorIdentity.id;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
module.exports = {
|
|
136
|
-
getParsedConfig,
|
|
137
|
-
getPolicyId,
|
|
138
|
-
createAuditEntity,
|
|
139
|
-
getAuditorId
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const certificateEndorsmentsList = [
|
|
143
|
-
'Waiver Of Subrogation',
|
|
144
|
-
'Certificate Holder',
|
|
145
|
-
'Additional Information',
|
|
146
|
-
'Additional Insured',
|
|
147
|
-
'Agreement'
|
|
148
|
-
];
|
|
149
|
-
|
|
150
|
-
const specialAttributes = {
|
|
151
|
-
'Certificate issue date': 'certIssueDate',
|
|
152
|
-
'Cancellation Terms': 'cancellationTerms',
|
|
153
|
-
'COI authentication': 'COIauthentication',
|
|
154
|
-
'AM Score': 'AMBestRating',
|
|
155
|
-
'Signature': 'signature',
|
|
156
|
-
|
|
157
|
-
'Insured Address': 'Insured Address',
|
|
158
|
-
'Insured Name': 'Insured Name',
|
|
159
|
-
|
|
160
|
-
'Additional Information': 'additionalInformation',
|
|
161
|
-
'Waiver Of Subrogation': 'waiverofsubrogation',
|
|
162
|
-
'Additional Insured': 'additionalInsured',
|
|
163
|
-
'Certificate Holder': 'certificateHolder',
|
|
164
|
-
|
|
165
|
-
'Coverage Exists': 'coverageexists',
|
|
166
|
-
'Coverage exists': 'coverageexists',
|
|
167
|
-
'Policy Number': 'policynumber',
|
|
168
|
-
'Policy Expiry': 'expirydate',
|
|
169
|
-
'Per Occur': 'PerOccur',
|
|
170
|
-
|
|
171
|
-
'Occur': {
|
|
172
|
-
'Excess Liability': 'EXoccur',
|
|
173
|
-
'Umbrella': 'UMoccur'
|
|
174
|
-
}
|
|
175
|
-
};
|
|
1
|
+
const { AUDIT_ENTITY_STATUSES, DEFAULT_POLICY_ID, VALID_SCORES } = require('../consts/audit');
|
|
2
|
+
const { isObject, isArray } = require('../../../../common/utils/dataTypeUtils');
|
|
3
|
+
const timeUtils = require('../../../../common/utils/timeUtils');
|
|
4
|
+
const auditModels = require('../models/audit/audit.model');
|
|
5
|
+
const { getEnv, getSystemUserIdentity } = require('../../../../env');
|
|
6
|
+
const { credentials } = getEnv();
|
|
7
|
+
|
|
8
|
+
const emptyValue = '';
|
|
9
|
+
|
|
10
|
+
const getValueBySelection = selection => {
|
|
11
|
+
return ['Yes', 'No', 'Empty', 'Claims'].includes(selection) ? emptyValue : selection;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const getDateInApiFormat = date => {
|
|
15
|
+
return timeUtils.convertDateToNewFormat(
|
|
16
|
+
date,
|
|
17
|
+
timeUtils.formats.dayMonthYear,
|
|
18
|
+
timeUtils.formats.numericMonthDayYear
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const getAttributeKey = attribute => {
|
|
23
|
+
return specialAttributes[attribute] || attribute;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getPolicyId = (policyName, requirement) => {
|
|
27
|
+
if (!policyName || policyName === 'Certificate of Insurance') {
|
|
28
|
+
return DEFAULT_POLICY_ID;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const policy = requirement.policies.find(policy => policy.name === policyName);
|
|
32
|
+
|
|
33
|
+
if (!policy) {
|
|
34
|
+
let policiesList = emptyValue;
|
|
35
|
+
requirement.policies.forEach(policy => policiesList += `${policy.name},`);
|
|
36
|
+
|
|
37
|
+
throw Error(`Policy '${policyName}' not found in the Requirement. List: ${policiesList.slice(0, -1)}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return policy.id;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const getParsedConfig = function(config) {
|
|
44
|
+
const auditDataArr = [];
|
|
45
|
+
for (const field in config) {
|
|
46
|
+
if (!config.hasOwnProperty(field)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (isObject(config[field])) {
|
|
51
|
+
const attributes = config[field];
|
|
52
|
+
for (const attributeName in attributes) {
|
|
53
|
+
if (attributeName === 'Policy Expiry') {
|
|
54
|
+
attributes[attributeName] = getDateInApiFormat(attributes[attributeName]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const selection = { policyName: field };
|
|
58
|
+
|
|
59
|
+
// Special attribute names switch
|
|
60
|
+
switch (attributeName) {
|
|
61
|
+
case 'Occur':
|
|
62
|
+
const occurKeys = getAttributeKey(attributeName);
|
|
63
|
+
selection.attributeName = occurKeys[field];
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
selection.attributeName = getAttributeKey(attributeName);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (isArray(attributes[attributeName])) {
|
|
71
|
+
selection.status = AUDIT_ENTITY_STATUSES[ (attributes[attributeName][0]).toUpperCase() ];
|
|
72
|
+
selection.value = attributes[attributeName][1].replace('$', emptyValue);
|
|
73
|
+
} else {
|
|
74
|
+
// Special statuses switch
|
|
75
|
+
switch (selection.attributeName) {
|
|
76
|
+
case getAttributeKey('Policy Number'):
|
|
77
|
+
selection.status = emptyValue;
|
|
78
|
+
break;
|
|
79
|
+
case getAttributeKey('Policy Expiry'):
|
|
80
|
+
selection.status = AUDIT_ENTITY_STATUSES.YES;
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
selection.status = AUDIT_ENTITY_STATUSES[ (attributes[attributeName]).toUpperCase() ];
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
selection.value = getValueBySelection(attributes[attributeName]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
auditDataArr.push(selection);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (field === 'Certificate issue date') {
|
|
94
|
+
config[field] = getDateInApiFormat(config[field]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const selection = { attributeName: getAttributeKey(field) };
|
|
98
|
+
certificateEndorsmentsList.includes(field) && (selection.policyName = field);
|
|
99
|
+
|
|
100
|
+
if (isArray(config[field])) {
|
|
101
|
+
selection.status = AUDIT_ENTITY_STATUSES[ (config[field][0]).toUpperCase() ];
|
|
102
|
+
selection.value = config[field][1]; // Ok to be undefined
|
|
103
|
+
} else {
|
|
104
|
+
selection.status = AUDIT_ENTITY_STATUSES[ (config[field]).toUpperCase() ] || AUDIT_ENTITY_STATUSES.YES;
|
|
105
|
+
selection.value = getValueBySelection(config[field]);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (field === 'AM Score') {
|
|
109
|
+
selection.status = VALID_SCORES.includes(selection.value) ? AUDIT_ENTITY_STATUSES.YES : AUDIT_ENTITY_STATUSES.NO;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
auditDataArr.push(selection);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return auditDataArr;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const createAuditEntity = (
|
|
119
|
+
requirement, {
|
|
120
|
+
policyName = null,
|
|
121
|
+
attributeName = null,
|
|
122
|
+
value = emptyValue,
|
|
123
|
+
status = emptyValue
|
|
124
|
+
}) => {
|
|
125
|
+
const policyId = getPolicyId(policyName, requirement);
|
|
126
|
+
const auditEntityModel = new auditModels.AuditEntityModel(policyId, attributeName, status, value);
|
|
127
|
+
return auditEntityModel;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const getAuditorId = () => {
|
|
131
|
+
const auditorIdentity = getSystemUserIdentity(credentials.auditorUser);
|
|
132
|
+
return auditorIdentity.id;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
module.exports = {
|
|
136
|
+
getParsedConfig,
|
|
137
|
+
getPolicyId,
|
|
138
|
+
createAuditEntity,
|
|
139
|
+
getAuditorId
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const certificateEndorsmentsList = [
|
|
143
|
+
'Waiver Of Subrogation',
|
|
144
|
+
'Certificate Holder',
|
|
145
|
+
'Additional Information',
|
|
146
|
+
'Additional Insured',
|
|
147
|
+
'Agreement'
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
const specialAttributes = {
|
|
151
|
+
'Certificate issue date': 'certIssueDate',
|
|
152
|
+
'Cancellation Terms': 'cancellationTerms',
|
|
153
|
+
'COI authentication': 'COIauthentication',
|
|
154
|
+
'AM Score': 'AMBestRating',
|
|
155
|
+
'Signature': 'signature',
|
|
156
|
+
|
|
157
|
+
'Insured Address': 'Insured Address',
|
|
158
|
+
'Insured Name': 'Insured Name',
|
|
159
|
+
|
|
160
|
+
'Additional Information': 'additionalInformation',
|
|
161
|
+
'Waiver Of Subrogation': 'waiverofsubrogation',
|
|
162
|
+
'Additional Insured': 'additionalInsured',
|
|
163
|
+
'Certificate Holder': 'certificateHolder',
|
|
164
|
+
|
|
165
|
+
'Coverage Exists': 'coverageexists',
|
|
166
|
+
'Coverage exists': 'coverageexists',
|
|
167
|
+
'Policy Number': 'policynumber',
|
|
168
|
+
'Policy Expiry': 'expirydate',
|
|
169
|
+
'Per Occur': 'PerOccur',
|
|
170
|
+
|
|
171
|
+
'Occur': {
|
|
172
|
+
'Excess Liability': 'EXoccur',
|
|
173
|
+
'Umbrella': 'UMoccur'
|
|
174
|
+
}
|
|
175
|
+
};
|
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
create: `${backendUrl}/saas/contractors/invite`,
|
|
6
|
-
get: `${backendUrl}/saas/contractors`,
|
|
7
|
-
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
8
|
-
getRecordHistory: contractorId => `${backendUrl}/saas/record/${contractorId}/history`,
|
|
9
|
-
delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
10
|
-
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
11
|
-
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
12
|
-
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
|
-
sendGaps: `${backendUrl}/saas/contractor/compliance/status`,
|
|
14
|
-
requestNewCoiAboutToExpire: `${backendUrl}/saas/coi/about-to-expire`,
|
|
15
|
-
requestNewCoiExpired: `${backendUrl}/saas/coi/expired`,
|
|
16
|
-
resendInvitation: contractorId => `${backendUrl}/saas/contractor/${contractorId}/reminders/reset`,
|
|
17
|
-
muteNotifications: `${backendUrl}/saas/record/notifications/mute`,
|
|
18
|
-
unmuteNotifications: `${backendUrl}/saas/record/notifications/unmute`,
|
|
19
|
-
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
20
|
-
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
21
|
-
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
22
|
-
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
23
|
-
`${backendUrl}/saas/
|
|
24
|
-
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const createContractor = (createContractorModel, context) => {
|
|
28
|
-
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const getContractorsByAccountId = (params, context) => {
|
|
32
|
-
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const getContractorById = (contractorId, context) => {
|
|
36
|
-
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const getRecordHistory = (contractorId, context) => {
|
|
40
|
-
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const deleteByContractorId = (contractorId, context) => {
|
|
44
|
-
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const archiveByContractorId = (contractorId, context) => {
|
|
48
|
-
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const restoreContractor = (recordVerificationModel, context) => {
|
|
52
|
-
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const editContractor = (editRequestModel, context) => {
|
|
56
|
-
const params = { updateInfoUser: 'EditVendor' };
|
|
57
|
-
const { record: { contractorId } } = editRequestModel;
|
|
58
|
-
return requests.postRequestHandler(Endpoints.edit(contractorId), editRequestModel, context, {}, params);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
62
|
-
return requests.postRequestHandler(Endpoints.muteNotifications, recordModifyDateVerificationModel, context);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
66
|
-
return requests.postRequestHandler(Endpoints.unmuteNotifications, recordModifyDateVerificationModel, context);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
70
|
-
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
74
|
-
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
78
|
-
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
82
|
-
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
86
|
-
const recordId = recordModifyDateVerificationModel.contractorId;
|
|
87
|
-
return requests.postRequestHandler(Endpoints.resendInvitation(recordId), recordModifyDateVerificationModel, context);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
91
|
-
const data = { [policyName]: expiryDate };
|
|
92
|
-
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
96
|
-
const data = { date: inviteDate };
|
|
97
|
-
return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const getContractorsByTabId = async (tabId, context, activityStatus) => {
|
|
101
|
-
const body = { tabId, activityStatus };
|
|
102
|
-
const response = await requests.postRequestHandler(Endpoints.get, body, context);
|
|
103
|
-
const records = {
|
|
104
|
-
... response,
|
|
105
|
-
data: response.data.map(({ record }) => record)
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return records;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const searchInAutocomplete = ({ tabId, searchWord }, context) => {
|
|
112
|
-
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
116
|
-
const url = `${Endpoints.automationUpdateContractorUploadDate(contractorId) }?uploadDate=${uploadDate.toISOString()}`;
|
|
117
|
-
return requests.patchRequestHandler(url, context);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
module.exports = {
|
|
121
|
-
createContractor,
|
|
122
|
-
changeRequirement,
|
|
123
|
-
getContractorsByAccountId,
|
|
124
|
-
getContractorById,
|
|
125
|
-
getRecordHistory,
|
|
126
|
-
deleteByContractorId,
|
|
127
|
-
archiveByContractorId,
|
|
128
|
-
restoreContractor,
|
|
129
|
-
editContractor,
|
|
130
|
-
updateInviteDate,
|
|
131
|
-
updateExpiryDate,
|
|
132
|
-
getContractorsByTabId,
|
|
133
|
-
searchInAutocomplete,
|
|
134
|
-
updateContractorUploadDate,
|
|
135
|
-
sendGaps,
|
|
136
|
-
requestNewCoiAboutToExpire,
|
|
137
|
-
requestNewCoiExpired,
|
|
138
|
-
resendInvitation,
|
|
139
|
-
muteNotifications,
|
|
140
|
-
unmuteNotifications
|
|
141
|
-
};
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
create: `${backendUrl}/saas/contractors/invite`,
|
|
6
|
+
get: `${backendUrl}/saas/contractors`,
|
|
7
|
+
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
8
|
+
getRecordHistory: contractorId => `${backendUrl}/saas/record/${contractorId}/history`,
|
|
9
|
+
delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
10
|
+
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
11
|
+
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
12
|
+
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
|
+
sendGaps: `${backendUrl}/saas/contractor/compliance/status`,
|
|
14
|
+
requestNewCoiAboutToExpire: `${backendUrl}/saas/coi/about-to-expire`,
|
|
15
|
+
requestNewCoiExpired: `${backendUrl}/saas/coi/expired`,
|
|
16
|
+
resendInvitation: contractorId => `${backendUrl}/saas/contractor/${contractorId}/reminders/reset`,
|
|
17
|
+
muteNotifications: `${backendUrl}/saas/record/notifications/mute`,
|
|
18
|
+
unmuteNotifications: `${backendUrl}/saas/record/notifications/unmute`,
|
|
19
|
+
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
20
|
+
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
21
|
+
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
22
|
+
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
23
|
+
`${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
24
|
+
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const createContractor = (createContractorModel, context) => {
|
|
28
|
+
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getContractorsByAccountId = (params, context) => {
|
|
32
|
+
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getContractorById = (contractorId, context) => {
|
|
36
|
+
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getRecordHistory = (contractorId, context) => {
|
|
40
|
+
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const deleteByContractorId = (contractorId, context) => {
|
|
44
|
+
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const archiveByContractorId = (contractorId, context) => {
|
|
48
|
+
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const restoreContractor = (recordVerificationModel, context) => {
|
|
52
|
+
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const editContractor = (editRequestModel, context) => {
|
|
56
|
+
const params = { updateInfoUser: 'EditVendor' };
|
|
57
|
+
const { record: { contractorId } } = editRequestModel;
|
|
58
|
+
return requests.postRequestHandler(Endpoints.edit(contractorId), editRequestModel, context, {}, params);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
62
|
+
return requests.postRequestHandler(Endpoints.muteNotifications, recordModifyDateVerificationModel, context);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
66
|
+
return requests.postRequestHandler(Endpoints.unmuteNotifications, recordModifyDateVerificationModel, context);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
70
|
+
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
74
|
+
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
78
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
82
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
86
|
+
const recordId = recordModifyDateVerificationModel.contractorId;
|
|
87
|
+
return requests.postRequestHandler(Endpoints.resendInvitation(recordId), recordModifyDateVerificationModel, context);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
91
|
+
const data = { [policyName]: expiryDate };
|
|
92
|
+
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
96
|
+
const data = { date: inviteDate };
|
|
97
|
+
return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const getContractorsByTabId = async (tabId, context, activityStatus) => {
|
|
101
|
+
const body = { tabId, activityStatus };
|
|
102
|
+
const response = await requests.postRequestHandler(Endpoints.get, body, context);
|
|
103
|
+
const records = {
|
|
104
|
+
... response,
|
|
105
|
+
data: response.data.map(({ record }) => record)
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return records;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const searchInAutocomplete = ({ tabId, searchWord }, context) => {
|
|
112
|
+
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
116
|
+
const url = `${Endpoints.automationUpdateContractorUploadDate(contractorId) }?uploadDate=${uploadDate.toISOString()}`;
|
|
117
|
+
return requests.patchRequestHandler(url, context);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
module.exports = {
|
|
121
|
+
createContractor,
|
|
122
|
+
changeRequirement,
|
|
123
|
+
getContractorsByAccountId,
|
|
124
|
+
getContractorById,
|
|
125
|
+
getRecordHistory,
|
|
126
|
+
deleteByContractorId,
|
|
127
|
+
archiveByContractorId,
|
|
128
|
+
restoreContractor,
|
|
129
|
+
editContractor,
|
|
130
|
+
updateInviteDate,
|
|
131
|
+
updateExpiryDate,
|
|
132
|
+
getContractorsByTabId,
|
|
133
|
+
searchInAutocomplete,
|
|
134
|
+
updateContractorUploadDate,
|
|
135
|
+
sendGaps,
|
|
136
|
+
requestNewCoiAboutToExpire,
|
|
137
|
+
requestNewCoiExpired,
|
|
138
|
+
resendInvitation,
|
|
139
|
+
muteNotifications,
|
|
140
|
+
unmuteNotifications
|
|
141
|
+
};
|