@getjones/test-infra 2.8.2 → 2.8.4
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 +29 -29
- package/src/common/commonFlows/auth/auth.js +40 -40
- package/src/common/commonFlows/index.js +4 -4
- package/src/common/commonFlows/records/records.js +72 -72
- package/src/common/consts/dashboardCharts.js +17 -17
- package/src/common/consts/recordTypes.js +5 -5
- package/src/common/consts/userTypes.js +5 -5
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/requests/apiKeyAuth/requests.js +44 -44
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/requestHandlers.js +78 -78
- package/src/common/utils/complianceUtil.js +56 -56
- package/src/common/utils/dataTypeUtils.js +41 -41
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/objectUtils.js +7 -7
- package/src/common/utils/timeUtils.js +175 -175
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/auditConfigs.js +91 -91
- package/src/defaults/configs/coverage.js +227 -227
- package/src/defaults/configs/polices.js +49 -49
- package/src/defaults/configs/requirement.js +32 -32
- package/src/defaults/index.js +6 -6
- package/src/env.js +57 -57
- package/src/factory/index.js +7 -7
- package/src/factory/records/records.js +142 -141
- package/src/factory/users/users.js +79 -79
- package/src/index.js +81 -81
- 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 +41 -41
- 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 +38 -36
- package/src/saas/internal-api/accounts/utils/utils.js +66 -66
- package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
- package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +115 -115
- package/src/saas/internal-api/auditNotes/index.js +4 -4
- package/src/saas/internal-api/auditNotes/models/audit.note.model.js +30 -30
- package/src/saas/internal-api/auth/api/auth.api.js +27 -27
- package/src/saas/internal-api/auth/api/auth.service.js +90 -90
- 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 +5 -5
- 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 +46 -46
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +143 -143
- 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 +48 -48
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +33 -33
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +127 -127
- package/src/saas/internal-api/compliance/consts/audit.js +71 -71
- package/src/saas/internal-api/compliance/index.js +33 -33
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +84 -84
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -49
- package/src/saas/internal-api/compliance/utils/auditUtil.js +222 -222
- package/src/saas/internal-api/compliance/utils/coverageUtil.js +40 -40
- package/src/saas/internal-api/contractors/api/contractors.api.js +153 -153
- package/src/saas/internal-api/contractors/api/contractors.service.js +169 -169
- package/src/saas/internal-api/contractors/consts/consts.js +6 -6
- package/src/saas/internal-api/contractors/index.js +9 -9
- package/src/saas/internal-api/contractors/models/assign.requirement.model.js +10 -10
- 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/dashboard/api/recordList.api.js +38 -38
- package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
- package/src/saas/internal-api/dashboard/index.js +5 -5
- package/src/saas/internal-api/dashboard/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 +37 -37
- package/src/saas/internal-api/dbEmails/index.js +5 -5
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +21 -21
- package/src/saas/internal-api/dbEmails/utils/util.js +68 -68
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +82 -82
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +95 -95
- 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 +35 -35
- 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 +41 -41
- package/src/saas/internal-api/projects/utils/utils.js +156 -156
- 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 +72 -72
- package/src/saas/internal-api/requests/api/requests.service.js +122 -114
- package/src/saas/internal-api/requests/index.js +14 -14
- package/src/saas/internal-api/requests/models/create.request.model.js +33 -33
- 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/requestsTable/api/requests.table.api.js +20 -20
- package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
- package/src/saas/internal-api/requestsTable/index.js +3 -3
- package/src/saas/internal-api/requirements/api/requirements.api.js +45 -45
- package/src/saas/internal-api/requirements/api/requirements.service.js +134 -134
- 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 +9 -9
- 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 +19 -19
- package/src/saas/internal-api/requirements/utils/utils.js +102 -102
- 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 -39
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +32 -32
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +78 -78
- 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 +11 -11
- package/src/saas/internal-api/users/models/tenent.user.model.js +11 -11
- package/src/saas/internal-api/users/models/users.model.js +31 -31
- package/src/saas/internal-api/users/utils/util.js +20 -20
- 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/coi/coi.api.js +20 -20
- package/src/saas/openapi/coi/coi.service.js +13 -13
- 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 +7 -7
- package/src/saas/openapi/requests/models/invite.request.model.js +37 -37
- package/src/saas/openapi/requests/models/update.request.model.js +35 -35
- package/src/saas/openapi/requests/requests.api.js +76 -76
- package/src/saas/openapi/requests/requests.service.js +65 -65
- 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 +26 -26
- package/src/saas/openapi/requirements/requirements.service.js +32 -32
- 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 +18 -13
- package/src/saas/openapi/tabs/tabs.service.js +11 -7
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
|
@@ -1,153 +1,153 @@
|
|
|
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/
|
|
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
|
-
assignRequirement: recordId => `${backendUrl}/saas/contractor/${recordId}/assign-requirement`,
|
|
26
|
-
linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects`
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const createContractor = (createContractorModel, context) => {
|
|
30
|
-
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const getContractorsByAccountId = (params, context) => {
|
|
34
|
-
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const getContractorById = (contractorId, context) => {
|
|
38
|
-
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const getRecordHistory = (contractorId, context) => {
|
|
42
|
-
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const deleteByContractorId = (contractorId, context) => {
|
|
46
|
-
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const archiveByContractorId = (contractorId, context) => {
|
|
50
|
-
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const restoreContractor = (recordVerificationModel, context) => {
|
|
54
|
-
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const editContractor = (editRequestModel, context) => {
|
|
58
|
-
const params = { updateInfoUser: 'EditVendor' };
|
|
59
|
-
const { record: { contractorId } } = editRequestModel;
|
|
60
|
-
return requests.postRequestHandler(Endpoints.edit(contractorId), editRequestModel, context, {}, params);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
64
|
-
return requests.postRequestHandler(Endpoints.muteNotifications, recordModifyDateVerificationModel, context);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
68
|
-
return requests.postRequestHandler(Endpoints.unmuteNotifications, recordModifyDateVerificationModel, context);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
72
|
-
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const assignRequirement = (recordId, assignRequirementModel, context) => {
|
|
76
|
-
return requests.putRequestHandler(Endpoints.assignRequirement(recordId), assignRequirementModel, context);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
80
|
-
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
84
|
-
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
88
|
-
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
92
|
-
const recordId = recordModifyDateVerificationModel.contractorId;
|
|
93
|
-
return requests.postRequestHandler(Endpoints.resendInvitation(recordId), recordModifyDateVerificationModel, context);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
97
|
-
const data = { [policyName]: expiryDate };
|
|
98
|
-
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
102
|
-
const data = { date: inviteDate };
|
|
103
|
-
return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const getContractorsByTabId = async (tabId, context, activityStatus) => {
|
|
107
|
-
const body = { tabId, activityStatus };
|
|
108
|
-
const response = await requests.postRequestHandler(Endpoints.get, body, context);
|
|
109
|
-
const records = {
|
|
110
|
-
... response,
|
|
111
|
-
data: response.data.map(({ record }) => record)
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return records;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const searchInAutocomplete = ({ tabId, searchWord }, context) => {
|
|
118
|
-
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
122
|
-
const url = `${Endpoints.automationUpdateContractorUploadDate(contractorId) }?uploadDate=${uploadDate.toISOString()}`;
|
|
123
|
-
return requests.patchRequestHandler(url, context);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const getLinkedProjectsCount = async (recordId, context) => {
|
|
127
|
-
return await requests.getRequestHandler(Endpoints.linkedProjectsCount(recordId), {}, context);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
module.exports = {
|
|
131
|
-
createContractor,
|
|
132
|
-
changeRequirement,
|
|
133
|
-
assignRequirement,
|
|
134
|
-
getContractorsByAccountId,
|
|
135
|
-
getContractorById,
|
|
136
|
-
getRecordHistory,
|
|
137
|
-
deleteByContractorId,
|
|
138
|
-
archiveByContractorId,
|
|
139
|
-
restoreContractor,
|
|
140
|
-
editContractor,
|
|
141
|
-
updateInviteDate,
|
|
142
|
-
updateExpiryDate,
|
|
143
|
-
getContractorsByTabId,
|
|
144
|
-
searchInAutocomplete,
|
|
145
|
-
updateContractorUploadDate,
|
|
146
|
-
sendGaps,
|
|
147
|
-
requestNewCoiAboutToExpire,
|
|
148
|
-
requestNewCoiExpired,
|
|
149
|
-
resendInvitation,
|
|
150
|
-
muteNotifications,
|
|
151
|
-
unmuteNotifications,
|
|
152
|
-
getLinkedProjectsCount
|
|
153
|
-
};
|
|
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: requestId => `${backendUrl}/saas/request/${requestId}/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
|
+
assignRequirement: recordId => `${backendUrl}/saas/contractor/${recordId}/assign-requirement`,
|
|
26
|
+
linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects`
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const createContractor = (createContractorModel, context) => {
|
|
30
|
+
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const getContractorsByAccountId = (params, context) => {
|
|
34
|
+
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getContractorById = (contractorId, context) => {
|
|
38
|
+
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getRecordHistory = (contractorId, context) => {
|
|
42
|
+
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const deleteByContractorId = (contractorId, context) => {
|
|
46
|
+
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const archiveByContractorId = (contractorId, context) => {
|
|
50
|
+
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const restoreContractor = (recordVerificationModel, context) => {
|
|
54
|
+
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const editContractor = (editRequestModel, context) => {
|
|
58
|
+
const params = { updateInfoUser: 'EditVendor' };
|
|
59
|
+
const { record: { contractorId } } = editRequestModel;
|
|
60
|
+
return requests.postRequestHandler(Endpoints.edit(contractorId), editRequestModel, context, {}, params);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
64
|
+
return requests.postRequestHandler(Endpoints.muteNotifications, recordModifyDateVerificationModel, context);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
68
|
+
return requests.postRequestHandler(Endpoints.unmuteNotifications, recordModifyDateVerificationModel, context);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
72
|
+
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const assignRequirement = (recordId, assignRequirementModel, context) => {
|
|
76
|
+
return requests.putRequestHandler(Endpoints.assignRequirement(recordId), assignRequirementModel, context);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const sendGaps = (requestId, recordModifyDateVerificationModel, context) => {
|
|
80
|
+
return requests.postRequestHandler(Endpoints.sendGaps(requestId), recordModifyDateVerificationModel, context);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
84
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
88
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
92
|
+
const recordId = recordModifyDateVerificationModel.contractorId;
|
|
93
|
+
return requests.postRequestHandler(Endpoints.resendInvitation(recordId), recordModifyDateVerificationModel, context);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
97
|
+
const data = { [policyName]: expiryDate };
|
|
98
|
+
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
102
|
+
const data = { date: inviteDate };
|
|
103
|
+
return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const getContractorsByTabId = async (tabId, context, activityStatus) => {
|
|
107
|
+
const body = { tabId, activityStatus };
|
|
108
|
+
const response = await requests.postRequestHandler(Endpoints.get, body, context);
|
|
109
|
+
const records = {
|
|
110
|
+
... response,
|
|
111
|
+
data: response.data.map(({ record }) => record)
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return records;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const searchInAutocomplete = ({ tabId, searchWord }, context) => {
|
|
118
|
+
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
122
|
+
const url = `${Endpoints.automationUpdateContractorUploadDate(contractorId) }?uploadDate=${uploadDate.toISOString()}`;
|
|
123
|
+
return requests.patchRequestHandler(url, context);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const getLinkedProjectsCount = async (recordId, context) => {
|
|
127
|
+
return await requests.getRequestHandler(Endpoints.linkedProjectsCount(recordId), {}, context);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
module.exports = {
|
|
131
|
+
createContractor,
|
|
132
|
+
changeRequirement,
|
|
133
|
+
assignRequirement,
|
|
134
|
+
getContractorsByAccountId,
|
|
135
|
+
getContractorById,
|
|
136
|
+
getRecordHistory,
|
|
137
|
+
deleteByContractorId,
|
|
138
|
+
archiveByContractorId,
|
|
139
|
+
restoreContractor,
|
|
140
|
+
editContractor,
|
|
141
|
+
updateInviteDate,
|
|
142
|
+
updateExpiryDate,
|
|
143
|
+
getContractorsByTabId,
|
|
144
|
+
searchInAutocomplete,
|
|
145
|
+
updateContractorUploadDate,
|
|
146
|
+
sendGaps,
|
|
147
|
+
requestNewCoiAboutToExpire,
|
|
148
|
+
requestNewCoiExpired,
|
|
149
|
+
resendInvitation,
|
|
150
|
+
muteNotifications,
|
|
151
|
+
unmuteNotifications,
|
|
152
|
+
getLinkedProjectsCount
|
|
153
|
+
};
|
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
const contractorsAPI = require('./contractors.api');
|
|
2
|
-
const { CreateContractorModel } = require('../models/create.contractor.model');
|
|
3
|
-
const { RequestModel } = require('../../requests/models/edit.request.model');
|
|
4
|
-
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
|
-
const { RecordModifyDateVerificationModel } = require('../models/verification.contractor.model');
|
|
6
|
-
const { AssignRequirementModel } = require('../models/assign.requirement.model');
|
|
7
|
-
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
8
|
-
|
|
9
|
-
const createContractor = async (createContractorModel, context) => {
|
|
10
|
-
validateType(createContractorModel, CreateContractorModel);
|
|
11
|
-
return contractorsAPI.createContractor(createContractorModel, context);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const getContractorsByAccountId = async (accountId, context, activationStatus = null) => {
|
|
15
|
-
if (activationStatus) {
|
|
16
|
-
activationStatus = activationStatus.reduce((f, s) => `${f},${s}`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return contractorsAPI.getContractorsByAccountId({ accountId, activationStatus }, context);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const getContractorById = (contractorId, context) => {
|
|
23
|
-
return contractorsAPI.getContractorById(contractorId, context);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const getRecordHistory = (contractorId, context) => {
|
|
27
|
-
return contractorsAPI.getRecordHistory(contractorId, context);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const archiveByContractorId = (contractorId, context) => {
|
|
31
|
-
return contractorsAPI.archiveByContractorId(contractorId, context);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const restoreContractor = (recordVerificationModel, context) => {
|
|
35
|
-
validateType(recordVerificationModel, RecordModifyDateVerificationModel);
|
|
36
|
-
return contractorsAPI.restoreContractor(recordVerificationModel, context);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const editContractor = (editRequestModel, context) => {
|
|
40
|
-
validateType(editRequestModel, RequestModel);
|
|
41
|
-
return contractorsAPI.editContractor(editRequestModel, context);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
45
|
-
return contractorsAPI.updateExpiryDate(contractorId, expiryDate, policyName);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const assignRequirement = (recordId, assignRequirementModel, context) => {
|
|
49
|
-
return contractorsAPI.assignRequirement(recordId, assignRequirementModel, context);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
53
|
-
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const getContractorsByTabId = (tabId, context, activityStatus = 'Active') => {
|
|
57
|
-
return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const searchInAutoComplete = ({ tabId, searchWord }, context) => {
|
|
61
|
-
return contractorsAPI.searchInAutocomplete({ tabId, searchWord }, context);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
65
|
-
validateType(uploadDate, Date);
|
|
66
|
-
return contractorsAPI.updateContractorUploadDate(contractorId, uploadDate, context);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
70
|
-
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
71
|
-
return contractorsAPI.changeRequirement(recordModifyDateVerificationModel, context);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
75
|
-
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
76
|
-
return contractorsAPI.sendGaps(recordModifyDateVerificationModel, context);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
80
|
-
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
81
|
-
return contractorsAPI.requestNewCoiAboutToExpire(recordModifyDateVerificationModel, context);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
85
|
-
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
86
|
-
return contractorsAPI.requestNewCoiExpired(recordModifyDateVerificationModel, context);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
90
|
-
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
91
|
-
return contractorsAPI.resendInvitation(recordModifyDateVerificationModel, context);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
95
|
-
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
96
|
-
return contractorsAPI.muteNotifications(recordModifyDateVerificationModel, context);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
100
|
-
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
101
|
-
return contractorsAPI.unmuteNotifications(recordModifyDateVerificationModel, context);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const deleteByContractorId = (contractorId, context) => {
|
|
105
|
-
return contractorsAPI.deleteByContractorId(contractorId, context);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const deleteAllRecordsInAccount = async (accountId, context, { activationStatus } = {}) => {
|
|
109
|
-
const { data: existingRecords } = await getContractorsByAccountId(accountId, context, activationStatus);
|
|
110
|
-
|
|
111
|
-
if (!existingRecords.length) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const failed = [];
|
|
116
|
-
for (const record of existingRecords) {
|
|
117
|
-
const response = await deleteByContractorId(record.id, context);
|
|
118
|
-
|
|
119
|
-
if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
120
|
-
console.error('Failed to delete record: ', record.company);
|
|
121
|
-
failed.push(response);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (failed.length) {
|
|
126
|
-
throw Error(`Failed to delete ${failed.length} of ${existingRecords.length} records in account. Failed with status: ${ failed[0].status }`);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const getRecordVerificationModel = async (recordId, context, { requirementId, requirementDateModified } = {}) => {
|
|
131
|
-
const { data: recordData } = await getContractorById(recordId, context);
|
|
132
|
-
return new RecordModifyDateVerificationModel(recordData.id, { contractorDateModified: recordData.dateModified, requirementId, requirementDateModified });
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const getAssignRequirementModel = (requirementId, companyName, emailAddress) => {
|
|
136
|
-
return new AssignRequirementModel(requirementId, companyName, emailAddress);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const getLinkedProjectsCount = (recordId, context) => {
|
|
140
|
-
return contractorsAPI.getLinkedProjectsCount(recordId, context);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
module.exports = {
|
|
144
|
-
createContractor,
|
|
145
|
-
changeRequirement,
|
|
146
|
-
getContractorsByAccountId,
|
|
147
|
-
getContractorById,
|
|
148
|
-
getRecordHistory,
|
|
149
|
-
archiveByContractorId,
|
|
150
|
-
restoreContractor,
|
|
151
|
-
editContractor,
|
|
152
|
-
updateInviteDate,
|
|
153
|
-
updateExpiryDate,
|
|
154
|
-
getContractorsByTabId,
|
|
155
|
-
searchInAutoComplete,
|
|
156
|
-
updateContractorUploadDate,
|
|
157
|
-
sendGaps,
|
|
158
|
-
requestNewCoiAboutToExpire,
|
|
159
|
-
requestNewCoiExpired,
|
|
160
|
-
resendInvitation,
|
|
161
|
-
muteNotifications,
|
|
162
|
-
unmuteNotifications,
|
|
163
|
-
deleteByContractorId,
|
|
164
|
-
deleteAllRecordsInAccount,
|
|
165
|
-
getRecordVerificationModel,
|
|
166
|
-
assignRequirement,
|
|
167
|
-
getAssignRequirementModel,
|
|
168
|
-
getLinkedProjectsCount
|
|
169
|
-
};
|
|
1
|
+
const contractorsAPI = require('./contractors.api');
|
|
2
|
+
const { CreateContractorModel } = require('../models/create.contractor.model');
|
|
3
|
+
const { RequestModel } = require('../../requests/models/edit.request.model');
|
|
4
|
+
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
|
+
const { RecordModifyDateVerificationModel } = require('../models/verification.contractor.model');
|
|
6
|
+
const { AssignRequirementModel } = require('../models/assign.requirement.model');
|
|
7
|
+
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
8
|
+
|
|
9
|
+
const createContractor = async (createContractorModel, context) => {
|
|
10
|
+
validateType(createContractorModel, CreateContractorModel);
|
|
11
|
+
return contractorsAPI.createContractor(createContractorModel, context);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const getContractorsByAccountId = async (accountId, context, activationStatus = null) => {
|
|
15
|
+
if (activationStatus) {
|
|
16
|
+
activationStatus = activationStatus.reduce((f, s) => `${f},${s}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return contractorsAPI.getContractorsByAccountId({ accountId, activationStatus }, context);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const getContractorById = (contractorId, context) => {
|
|
23
|
+
return contractorsAPI.getContractorById(contractorId, context);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getRecordHistory = (contractorId, context) => {
|
|
27
|
+
return contractorsAPI.getRecordHistory(contractorId, context);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const archiveByContractorId = (contractorId, context) => {
|
|
31
|
+
return contractorsAPI.archiveByContractorId(contractorId, context);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const restoreContractor = (recordVerificationModel, context) => {
|
|
35
|
+
validateType(recordVerificationModel, RecordModifyDateVerificationModel);
|
|
36
|
+
return contractorsAPI.restoreContractor(recordVerificationModel, context);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const editContractor = (editRequestModel, context) => {
|
|
40
|
+
validateType(editRequestModel, RequestModel);
|
|
41
|
+
return contractorsAPI.editContractor(editRequestModel, context);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
45
|
+
return contractorsAPI.updateExpiryDate(contractorId, expiryDate, policyName);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const assignRequirement = (recordId, assignRequirementModel, context) => {
|
|
49
|
+
return contractorsAPI.assignRequirement(recordId, assignRequirementModel, context);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
53
|
+
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const getContractorsByTabId = (tabId, context, activityStatus = 'Active') => {
|
|
57
|
+
return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const searchInAutoComplete = ({ tabId, searchWord }, context) => {
|
|
61
|
+
return contractorsAPI.searchInAutocomplete({ tabId, searchWord }, context);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
65
|
+
validateType(uploadDate, Date);
|
|
66
|
+
return contractorsAPI.updateContractorUploadDate(contractorId, uploadDate, context);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
70
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
71
|
+
return contractorsAPI.changeRequirement(recordModifyDateVerificationModel, context);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const sendGaps = (requestId, recordModifyDateVerificationModel, context) => {
|
|
75
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
76
|
+
return contractorsAPI.sendGaps(requestId, recordModifyDateVerificationModel, context);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
80
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
81
|
+
return contractorsAPI.requestNewCoiAboutToExpire(recordModifyDateVerificationModel, context);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
85
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
86
|
+
return contractorsAPI.requestNewCoiExpired(recordModifyDateVerificationModel, context);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
90
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
91
|
+
return contractorsAPI.resendInvitation(recordModifyDateVerificationModel, context);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
95
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
96
|
+
return contractorsAPI.muteNotifications(recordModifyDateVerificationModel, context);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
100
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
101
|
+
return contractorsAPI.unmuteNotifications(recordModifyDateVerificationModel, context);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const deleteByContractorId = (contractorId, context) => {
|
|
105
|
+
return contractorsAPI.deleteByContractorId(contractorId, context);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const deleteAllRecordsInAccount = async (accountId, context, { activationStatus } = {}) => {
|
|
109
|
+
const { data: existingRecords } = await getContractorsByAccountId(accountId, context, activationStatus);
|
|
110
|
+
|
|
111
|
+
if (!existingRecords.length) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const failed = [];
|
|
116
|
+
for (const record of existingRecords) {
|
|
117
|
+
const response = await deleteByContractorId(record.id, context);
|
|
118
|
+
|
|
119
|
+
if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
120
|
+
console.error('Failed to delete record: ', record.company);
|
|
121
|
+
failed.push(response);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (failed.length) {
|
|
126
|
+
throw Error(`Failed to delete ${failed.length} of ${existingRecords.length} records in account. Failed with status: ${ failed[0].status }`);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const getRecordVerificationModel = async (recordId, context, { requirementId, requirementDateModified } = {}) => {
|
|
131
|
+
const { data: recordData } = await getContractorById(recordId, context);
|
|
132
|
+
return new RecordModifyDateVerificationModel(recordData.id, { contractorDateModified: recordData.dateModified, requirementId, requirementDateModified });
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const getAssignRequirementModel = (requirementId, companyName, emailAddress) => {
|
|
136
|
+
return new AssignRequirementModel(requirementId, companyName, emailAddress);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const getLinkedProjectsCount = (recordId, context) => {
|
|
140
|
+
return contractorsAPI.getLinkedProjectsCount(recordId, context);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
module.exports = {
|
|
144
|
+
createContractor,
|
|
145
|
+
changeRequirement,
|
|
146
|
+
getContractorsByAccountId,
|
|
147
|
+
getContractorById,
|
|
148
|
+
getRecordHistory,
|
|
149
|
+
archiveByContractorId,
|
|
150
|
+
restoreContractor,
|
|
151
|
+
editContractor,
|
|
152
|
+
updateInviteDate,
|
|
153
|
+
updateExpiryDate,
|
|
154
|
+
getContractorsByTabId,
|
|
155
|
+
searchInAutoComplete,
|
|
156
|
+
updateContractorUploadDate,
|
|
157
|
+
sendGaps,
|
|
158
|
+
requestNewCoiAboutToExpire,
|
|
159
|
+
requestNewCoiExpired,
|
|
160
|
+
resendInvitation,
|
|
161
|
+
muteNotifications,
|
|
162
|
+
unmuteNotifications,
|
|
163
|
+
deleteByContractorId,
|
|
164
|
+
deleteAllRecordsInAccount,
|
|
165
|
+
getRecordVerificationModel,
|
|
166
|
+
assignRequirement,
|
|
167
|
+
getAssignRequirementModel,
|
|
168
|
+
getLinkedProjectsCount
|
|
169
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const RECORD_SHARING_LEVEL = {
|
|
2
|
-
account: 'Account',
|
|
3
|
-
tab: 'Tab'
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
module.exports = { RECORD_SHARING_LEVEL };
|
|
1
|
+
const RECORD_SHARING_LEVEL = {
|
|
2
|
+
account: 'Account',
|
|
3
|
+
tab: 'Tab'
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
module.exports = { RECORD_SHARING_LEVEL };
|