@getjones/test-infra 1.12.0 → 2.1.0
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/{factory → commonFlows}/index.js +3 -3
- package/src/common/{factory → 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/numberUtils.js +22 -22
- package/src/common/utils/timeUtils.js +162 -162
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/env.js +45 -45
- package/src/index.js +69 -69
- 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/index.js +20 -20
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +15 -15
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +19 -19
- package/src/saas/internal-api/accounts/utils/utils.js +32 -32
- package/src/saas/internal-api/auth/api/auth.api.js +12 -12
- package/src/saas/internal-api/auth/api/auth.service.js +47 -47
- 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 +33 -33
- 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/index.js +22 -22
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +110 -110
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +45 -45
- package/src/saas/internal-api/contractors/api/contractors.api.js +147 -146
- package/src/saas/internal-api/contractors/api/contractors.service.js +130 -129
- 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 -74
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
- 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 +34 -28
- package/src/saas/internal-api/requests/api/requests.service.js +31 -19
- package/src/saas/internal-api/requests/index.js +11 -9
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -0
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
- package/src/saas/internal-api/requests/utils.js +8 -0
- package/src/saas/internal-api/requirements/api/requirements.api.js +27 -27
- package/src/saas/internal-api/requirements/api/requirements.service.js +23 -23
- package/src/saas/internal-api/requirements/index.js +6 -6
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +45 -45
- 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 +13 -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,146 +1,147 @@
|
|
|
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/contractors/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
24
|
-
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
25
|
-
publicLinkInvite: `${backendUrl}/_saas/contractors/publicinvite`
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const createContractor = (createContractorModel, context) => {
|
|
29
|
-
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getContractorsByAccountId = (params, context) => {
|
|
33
|
-
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const getContractorById = (contractorId, context) => {
|
|
37
|
-
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const getRecordHistory = (contractorId, context) => {
|
|
41
|
-
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const deleteByContractorId = (contractorId, context) => {
|
|
45
|
-
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const archiveByContractorId = (contractorId, context) => {
|
|
49
|
-
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const restoreContractor = (recordVerificationModel, context) => {
|
|
53
|
-
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const editContractor = (
|
|
57
|
-
const params = { updateInfoUser: 'EditVendor' };
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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/contractors/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
24
|
+
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
25
|
+
publicLinkInvite: `${backendUrl}/_saas/contractors/publicinvite`
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const createContractor = (createContractorModel, context) => {
|
|
29
|
+
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const getContractorsByAccountId = (params, context) => {
|
|
33
|
+
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const getContractorById = (contractorId, context) => {
|
|
37
|
+
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const getRecordHistory = (contractorId, context) => {
|
|
41
|
+
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const deleteByContractorId = (contractorId, context) => {
|
|
45
|
+
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const archiveByContractorId = (contractorId, context) => {
|
|
49
|
+
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const restoreContractor = (recordVerificationModel, context) => {
|
|
53
|
+
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const editContractor = (editRequestModel, context) => {
|
|
57
|
+
const params = { updateInfoUser: 'EditVendor' };
|
|
58
|
+
const { record: { contractorId } } = editRequestModel;
|
|
59
|
+
return requests.postRequestHandler(Endpoints.edit(contractorId), editRequestModel, context, {}, params);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
63
|
+
return requests.postRequestHandler(Endpoints.muteNotifications, recordModifyDateVerificationModel, context);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
67
|
+
return requests.postRequestHandler(Endpoints.unmuteNotifications, recordModifyDateVerificationModel, context);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
71
|
+
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
75
|
+
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
79
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
83
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
87
|
+
const recordId = recordModifyDateVerificationModel.contractorId;
|
|
88
|
+
return requests.postRequestHandler(Endpoints.resendInvitation(recordId), recordModifyDateVerificationModel, context);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
92
|
+
const data = { [policyName]: expiryDate };
|
|
93
|
+
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
97
|
+
const data = { date: inviteDate };
|
|
98
|
+
return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const getContractorsByTabId = async (tabId, context, activityStatus) => {
|
|
102
|
+
const body = { tabId, activityStatus };
|
|
103
|
+
const response = await requests.postRequestHandler(Endpoints.get, body, context);
|
|
104
|
+
const records = {
|
|
105
|
+
... response,
|
|
106
|
+
data: response.data.map(({ record }) => record)
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return records;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const searchInAutocomplete = ({ tabId, searchWord }, context) => {
|
|
113
|
+
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
117
|
+
const url = `${Endpoints.automationUpdateContractorUploadDate(contractorId) }?uploadDate=${uploadDate.toISOString()}`;
|
|
118
|
+
return requests.patchRequestHandler(url, context);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const inviteContractorViaPublicLink = (createContractorModel, context) => {
|
|
122
|
+
return requests.postRequestHandler(Endpoints.publicLinkInvite, createContractorModel, context);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
module.exports = {
|
|
126
|
+
createContractor,
|
|
127
|
+
changeRequirement,
|
|
128
|
+
getContractorsByAccountId,
|
|
129
|
+
getContractorById,
|
|
130
|
+
getRecordHistory,
|
|
131
|
+
deleteByContractorId,
|
|
132
|
+
archiveByContractorId,
|
|
133
|
+
restoreContractor,
|
|
134
|
+
editContractor,
|
|
135
|
+
updateInviteDate,
|
|
136
|
+
updateExpiryDate,
|
|
137
|
+
getContractorsByTabId,
|
|
138
|
+
searchInAutocomplete,
|
|
139
|
+
updateContractorUploadDate,
|
|
140
|
+
inviteContractorViaPublicLink,
|
|
141
|
+
sendGaps,
|
|
142
|
+
requestNewCoiAboutToExpire,
|
|
143
|
+
requestNewCoiExpired,
|
|
144
|
+
resendInvitation,
|
|
145
|
+
muteNotifications,
|
|
146
|
+
unmuteNotifications
|
|
147
|
+
};
|
|
@@ -1,129 +1,130 @@
|
|
|
1
|
-
const contractorsAPI = require('./contractors.api');
|
|
2
|
-
const { CreateContractorModel } = require('../models/create.contractor.model');
|
|
3
|
-
const {
|
|
4
|
-
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
|
-
const { RecordModifyDateVerificationModel } = require('../models/verification.contractor.model');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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 { ACTIVATION_STATUSES } = require('../../../../../../../src/saas/internal-api/common/contractors/consts');
|
|
7
|
+
|
|
8
|
+
const createContractor = async (createContractorModel, context) => {
|
|
9
|
+
validateType(createContractorModel, CreateContractorModel);
|
|
10
|
+
return contractorsAPI.createContractor(createContractorModel, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getContractorsByAccountId = async (accountId, context, activationStatus = null) => {
|
|
14
|
+
if (activationStatus) {
|
|
15
|
+
activationStatus = activationStatus.reduce((f, s) => `${f},${s}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return contractorsAPI.getContractorsByAccountId({ accountId, activationStatus }, context);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const getContractorById = (contractorId, context) => {
|
|
22
|
+
return contractorsAPI.getContractorById(contractorId, context);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getRecordHistory = (contractorId, context) => {
|
|
26
|
+
return contractorsAPI.getRecordHistory(contractorId, context);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const deleteByContractorId = (contractorId, context) => {
|
|
30
|
+
return contractorsAPI.deleteByContractorId(contractorId, context);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const archiveByContractorId = (contractorId, context) => {
|
|
34
|
+
return contractorsAPI.archiveByContractorId(contractorId, context);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const restoreContractor = (recordVerificationModel, context) => {
|
|
38
|
+
validateType(recordVerificationModel, RecordModifyDateVerificationModel);
|
|
39
|
+
return contractorsAPI.restoreContractor(recordVerificationModel, context);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const editContractor = (editRequestModel, context) => {
|
|
43
|
+
validateType(editRequestModel, RequestModel);
|
|
44
|
+
return contractorsAPI.editContractor(editRequestModel, context);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
48
|
+
return contractorsAPI.updateExpiryDate(contractorId, expiryDate, policyName);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
52
|
+
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const getContractorsByTabId = (tabId, context, activityStatus = ACTIVATION_STATUSES.ACTIVE) => {
|
|
56
|
+
return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const searchInAutoComplete = ({ tabId, searchWord }, context) => {
|
|
60
|
+
return contractorsAPI.searchInAutocomplete({ tabId, searchWord }, context);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
64
|
+
validateType(uploadDate, Date);
|
|
65
|
+
return contractorsAPI.updateContractorUploadDate(contractorId, uploadDate, context);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const inviteContractorViaPublicLink = async (createContractorModel, context) => {
|
|
69
|
+
validateType(createContractorModel, CreateContractorModel);
|
|
70
|
+
return contractorsAPI.inviteContractorViaPublicLink(createContractorModel, context);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
74
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
75
|
+
return contractorsAPI.changeRequirement(recordModifyDateVerificationModel, context);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
79
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
80
|
+
return contractorsAPI.sendGaps(recordModifyDateVerificationModel, context);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
84
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
85
|
+
return contractorsAPI.requestNewCoiAboutToExpire(recordModifyDateVerificationModel, context);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
89
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
90
|
+
return contractorsAPI.requestNewCoiExpired(recordModifyDateVerificationModel, context);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
94
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
95
|
+
return contractorsAPI.resendInvitation(recordModifyDateVerificationModel, context);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
99
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
100
|
+
return contractorsAPI.muteNotifications(recordModifyDateVerificationModel, context);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
104
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
105
|
+
return contractorsAPI.unmuteNotifications(recordModifyDateVerificationModel, context);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
module.exports = {
|
|
109
|
+
createContractor,
|
|
110
|
+
changeRequirement,
|
|
111
|
+
getContractorsByAccountId,
|
|
112
|
+
getContractorById,
|
|
113
|
+
getRecordHistory,
|
|
114
|
+
deleteByContractorId,
|
|
115
|
+
archiveByContractorId,
|
|
116
|
+
restoreContractor,
|
|
117
|
+
editContractor,
|
|
118
|
+
updateInviteDate,
|
|
119
|
+
updateExpiryDate,
|
|
120
|
+
getContractorsByTabId,
|
|
121
|
+
searchInAutoComplete,
|
|
122
|
+
updateContractorUploadDate,
|
|
123
|
+
inviteContractorViaPublicLink,
|
|
124
|
+
sendGaps,
|
|
125
|
+
requestNewCoiAboutToExpire,
|
|
126
|
+
requestNewCoiExpired,
|
|
127
|
+
resendInvitation,
|
|
128
|
+
muteNotifications,
|
|
129
|
+
unmuteNotifications
|
|
130
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const createModel = require('./models/create.contractor.model');
|
|
2
|
-
const editModel = require('./models/edit.contractor.model');
|
|
3
|
-
const verificationModel = require('./models/verification.contractor.model');
|
|
4
|
-
const services = require('./api/contractors.service');
|
|
5
|
-
|
|
6
|
-
const models = { create: createModel, edit: editModel, verification: verificationModel };
|
|
7
|
-
|
|
8
|
-
module.exports = { services, models };
|
|
1
|
+
const createModel = require('./models/create.contractor.model');
|
|
2
|
+
const editModel = require('./models/edit.contractor.model');
|
|
3
|
+
const verificationModel = require('./models/verification.contractor.model');
|
|
4
|
+
const services = require('./api/contractors.service');
|
|
5
|
+
|
|
6
|
+
const models = { create: createModel, edit: editModel, verification: verificationModel };
|
|
7
|
+
|
|
8
|
+
module.exports = { services, models };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
2
|
-
|
|
3
|
-
function CreateContractorModel(requirementId, inviterEmail, vendorInfo, { tabId = null, sendMail = false, publicLink } = {}) {
|
|
4
|
-
this.reqId = requirementId;
|
|
5
|
-
this.inviterEmail = inviterEmail;
|
|
6
|
-
this.vendorInfo = vendorInfo;
|
|
7
|
-
this.disableMail = !sendMail;
|
|
8
|
-
this.tabId = tabId;
|
|
9
|
-
this.publicLink = publicLink;
|
|
10
|
-
|
|
11
|
-
vendorInfo && validateType(vendorInfo, ContractorInfo);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function ContractorInfo(recordType, email, companyName, additionalEmails) {
|
|
15
|
-
this.recordType = recordType;
|
|
16
|
-
this.email = email;
|
|
17
|
-
this.companyName = companyName;
|
|
18
|
-
this.title = email;
|
|
19
|
-
this.additionalEmails = additionalEmails;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = { CreateContractorModel, ContractorInfo };
|
|
1
|
+
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
2
|
+
|
|
3
|
+
function CreateContractorModel(requirementId, inviterEmail, vendorInfo, { tabId = null, sendMail = false, publicLink } = {}) {
|
|
4
|
+
this.reqId = requirementId;
|
|
5
|
+
this.inviterEmail = inviterEmail;
|
|
6
|
+
this.vendorInfo = vendorInfo;
|
|
7
|
+
this.disableMail = !sendMail;
|
|
8
|
+
this.tabId = tabId;
|
|
9
|
+
this.publicLink = publicLink;
|
|
10
|
+
|
|
11
|
+
vendorInfo && validateType(vendorInfo, ContractorInfo);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function ContractorInfo(recordType, email, companyName, additionalEmails) {
|
|
15
|
+
this.recordType = recordType;
|
|
16
|
+
this.email = email;
|
|
17
|
+
this.companyName = companyName;
|
|
18
|
+
this.title = email;
|
|
19
|
+
this.additionalEmails = additionalEmails;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = { CreateContractorModel, ContractorInfo };
|