@getjones/test-infra 2.8.5 → 2.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/factory/records/records.js +2 -1
- package/src/index.js +3 -1
- package/src/saas/internal-api/agreement/api/agreement.api.js +24 -0
- package/src/saas/internal-api/agreement/api/agreement.service.js +17 -0
- package/src/saas/internal-api/agreement/consts/consts.js +8 -0
- package/src/saas/internal-api/agreement/index.js +11 -0
- package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -0
- package/src/saas/internal-api/contractors/api/contractors.api.js +17 -18
- package/src/saas/internal-api/contractors/api/contractors.service.js +14 -14
- package/src/saas/internal-api/requests/api/requests.service.js +9 -1
package/package.json
CHANGED
|
@@ -121,8 +121,9 @@ const prepareWaivedRecord = async (recordCompany, recordEmail, tabId, requiremen
|
|
|
121
121
|
const prepareAwaitingNewCoiRecord = async (recordCompany, recordEmail, tabId, requirementId, context) => {
|
|
122
122
|
const recordId = await prepareRecord(recordCompany, recordEmail, complianceStatuses.awaitingNewCoi, tabId, requirementId, context);
|
|
123
123
|
|
|
124
|
+
const { id: requestId } = await requests.services.getRequestFromTabByRecordId(recordId, tabId, context);
|
|
124
125
|
const recordVerificationModel = await contractors.services.getRecordVerificationModel(recordId, context);
|
|
125
|
-
const sendGapsResponse = await contractors.services.sendGaps(recordVerificationModel, context);
|
|
126
|
+
const sendGapsResponse = await contractors.services.sendGaps(requestId, recordVerificationModel, context);
|
|
126
127
|
|
|
127
128
|
if (sendGapsResponse.status !== httpResponseStatusCodes.OK) {
|
|
128
129
|
throw Error(`Failed to send gaps to ${recordCompany}\n${sendGapsResponse}`);
|
package/src/index.js
CHANGED
|
@@ -38,6 +38,7 @@ const getInternalAPI = () => {
|
|
|
38
38
|
|
|
39
39
|
const threadScheduler = require('./saas/internal-api/thread-scheduler/runner');
|
|
40
40
|
const dbEmails = require('./saas/internal-api/dbEmails/index');
|
|
41
|
+
const agreement = require('./saas/internal-api/agreement/index');
|
|
41
42
|
|
|
42
43
|
const internalAPI = {
|
|
43
44
|
defaults,
|
|
@@ -61,7 +62,8 @@ const getInternalAPI = () => {
|
|
|
61
62
|
requestsTable,
|
|
62
63
|
threadScheduler,
|
|
63
64
|
dbEmails,
|
|
64
|
-
factory
|
|
65
|
+
factory,
|
|
66
|
+
agreement
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
return internalAPI;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const AGREEMENT_API_URL = `${backendUrl}/saas/contractor/agreement`;
|
|
5
|
+
|
|
6
|
+
const Endpoints = {
|
|
7
|
+
create: AGREEMENT_API_URL,
|
|
8
|
+
delete: AGREEMENT_API_URL
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const createAgreement = (createAgreementModel, context) => {
|
|
12
|
+
return requests.postRequestHandler(Endpoints.create, createAgreementModel, context);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const deleteAgreement = (recordId, context) => {
|
|
16
|
+
const headers = {};
|
|
17
|
+
const params = { contractorId: recordId };
|
|
18
|
+
return requests.deleteRequestHandler(Endpoints.delete, context, headers, params);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
createAgreement,
|
|
23
|
+
deleteAgreement
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const agreementAPI = require('./agreement.api');
|
|
2
|
+
const { CreateAgreementModel } = require('../models/create.agreement.model');
|
|
3
|
+
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
4
|
+
|
|
5
|
+
const createAgreement = (createAgreementModel, context) => {
|
|
6
|
+
validateType(createAgreementModel, CreateAgreementModel);
|
|
7
|
+
return agreementAPI.createAgreement(createAgreementModel, context);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const deleteAgreement = (recordId, context) => {
|
|
11
|
+
return agreementAPI.deleteAgreement(recordId, context);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
createAgreement,
|
|
16
|
+
deleteAgreement
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const createModel = require('./models/create.agreement.model');
|
|
2
|
+
const services = require('./api/agreement.service');
|
|
3
|
+
const agreementConsts = require('./consts/consts');
|
|
4
|
+
|
|
5
|
+
const models = { create: createModel };
|
|
6
|
+
|
|
7
|
+
const consts = {
|
|
8
|
+
agreement: agreementConsts
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = { services, models, consts };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { UPLOADER_TYPE } = require('../consts/consts');
|
|
2
|
+
|
|
3
|
+
class CreateAgreementModel {
|
|
4
|
+
constructor({ contractorId, contractorDateModified, uploaderId, signedContractName, uploaderType = UPLOADER_TYPE.USER }) {
|
|
5
|
+
this.contractorId = contractorId;
|
|
6
|
+
this.contractorDateModified = contractorDateModified;
|
|
7
|
+
this.uploaderId = uploaderId;
|
|
8
|
+
this.signedContractName = signedContractName;
|
|
9
|
+
this.uploaderType = uploaderType;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
module.exports = { CreateAgreementModel };
|
|
@@ -10,10 +10,10 @@ const Endpoints = {
|
|
|
10
10
|
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
11
11
|
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
12
12
|
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
|
-
sendGaps: `${backendUrl}/saas/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
sendGaps: requestId => `${backendUrl}/saas/request/${requestId}/compliance/status`,
|
|
14
|
+
resendInvitation: requestId => `${backendUrl}/saas/contractor/${requestId}/reminders/reset`,
|
|
15
|
+
requestNewCoiAboutToExpire: requestId => `${backendUrl}/saas/coi/${requestId}/about-to-expire`,
|
|
16
|
+
requestNewCoiExpired: requestId => `${backendUrl}/saas/coi/${requestId}/expired`,
|
|
17
17
|
muteNotifications: `${backendUrl}/saas/record/notifications/mute`,
|
|
18
18
|
unmuteNotifications: `${backendUrl}/saas/record/notifications/unmute`,
|
|
19
19
|
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
@@ -22,7 +22,7 @@ const Endpoints = {
|
|
|
22
22
|
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
23
23
|
`${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
24
24
|
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
25
|
-
assignRequirement:
|
|
25
|
+
assignRequirement: requestId => `${backendUrl}/saas/contractor/${requestId}/assign-requirement`,
|
|
26
26
|
linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects`
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -50,7 +50,7 @@ const archiveByContractorId = (contractorId, context) => {
|
|
|
50
50
|
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
const
|
|
53
|
+
const restoreRecord = (recordVerificationModel, context) => {
|
|
54
54
|
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -72,25 +72,24 @@ const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
|
72
72
|
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
const assignRequirement = (
|
|
76
|
-
return requests.putRequestHandler(Endpoints.assignRequirement(
|
|
75
|
+
const assignRequirement = (requestId, assignRequirementModel, context) => {
|
|
76
|
+
return requests.putRequestHandler(Endpoints.assignRequirement(requestId), assignRequirementModel, context);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
80
|
-
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
79
|
+
const sendGaps = (requestId, recordModifyDateVerificationModel, context) => {
|
|
80
|
+
return requests.postRequestHandler(Endpoints.sendGaps(requestId), recordModifyDateVerificationModel, context);
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
84
|
-
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
83
|
+
const requestNewCoiAboutToExpire = (requestId, recordModifyDateVerificationModel, context) => {
|
|
84
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire(requestId), recordModifyDateVerificationModel, context);
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
88
|
-
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
87
|
+
const requestNewCoiExpired = (requestId, recordModifyDateVerificationModel, context) => {
|
|
88
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiExpired(requestId), recordModifyDateVerificationModel, context);
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
92
|
-
|
|
93
|
-
return requests.postRequestHandler(Endpoints.resendInvitation(recordId), recordModifyDateVerificationModel, context);
|
|
91
|
+
const resendInvitation = (requestId, recordModifyDateVerificationModel, context) => {
|
|
92
|
+
return requests.postRequestHandler(Endpoints.resendInvitation(requestId), recordModifyDateVerificationModel, context);
|
|
94
93
|
};
|
|
95
94
|
|
|
96
95
|
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
@@ -136,7 +135,7 @@ module.exports = {
|
|
|
136
135
|
getRecordHistory,
|
|
137
136
|
deleteByContractorId,
|
|
138
137
|
archiveByContractorId,
|
|
139
|
-
|
|
138
|
+
restoreRecord,
|
|
140
139
|
editContractor,
|
|
141
140
|
updateInviteDate,
|
|
142
141
|
updateExpiryDate,
|
|
@@ -31,9 +31,9 @@ const archiveByContractorId = (contractorId, context) => {
|
|
|
31
31
|
return contractorsAPI.archiveByContractorId(contractorId, context);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const restoreRecord = (recordVerificationModel, context) => {
|
|
35
35
|
validateType(recordVerificationModel, RecordModifyDateVerificationModel);
|
|
36
|
-
return contractorsAPI.
|
|
36
|
+
return contractorsAPI.restoreRecord(recordVerificationModel, context);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const editContractor = (editRequestModel, context) => {
|
|
@@ -45,8 +45,8 @@ const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
|
45
45
|
return contractorsAPI.updateExpiryDate(contractorId, expiryDate, policyName);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const assignRequirement = (
|
|
49
|
-
return contractorsAPI.assignRequirement(
|
|
48
|
+
const assignRequirement = (requestId, assignRequirementModel, context) => {
|
|
49
|
+
return contractorsAPI.assignRequirement(requestId, assignRequirementModel, context);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
@@ -71,24 +71,24 @@ const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
|
71
71
|
return contractorsAPI.changeRequirement(recordModifyDateVerificationModel, context);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
74
|
+
const sendGaps = (requestId, recordModifyDateVerificationModel, context) => {
|
|
75
75
|
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
76
|
-
return contractorsAPI.sendGaps(recordModifyDateVerificationModel, context);
|
|
76
|
+
return contractorsAPI.sendGaps(requestId, recordModifyDateVerificationModel, context);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
79
|
+
const requestNewCoiAboutToExpire = (requestId, recordModifyDateVerificationModel, context) => {
|
|
80
80
|
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
81
|
-
return contractorsAPI.requestNewCoiAboutToExpire(recordModifyDateVerificationModel, context);
|
|
81
|
+
return contractorsAPI.requestNewCoiAboutToExpire(requestId, recordModifyDateVerificationModel, context);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
84
|
+
const requestNewCoiExpired = (requestId, recordModifyDateVerificationModel, context) => {
|
|
85
85
|
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
86
|
-
return contractorsAPI.requestNewCoiExpired(recordModifyDateVerificationModel, context);
|
|
86
|
+
return contractorsAPI.requestNewCoiExpired(requestId, recordModifyDateVerificationModel, context);
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
89
|
+
const resendInvitation = (requestId, recordModifyDateVerificationModel, context) => {
|
|
90
90
|
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
91
|
-
return contractorsAPI.resendInvitation(recordModifyDateVerificationModel, context);
|
|
91
|
+
return contractorsAPI.resendInvitation(requestId, recordModifyDateVerificationModel, context);
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
@@ -142,7 +142,7 @@ const getLinkedProjectsCount = (recordId, context) => {
|
|
|
142
142
|
|
|
143
143
|
const restoreByRecordId = async (recordId, context) => {
|
|
144
144
|
const recordModifyModel = await getRecordVerificationModel(recordId, context);
|
|
145
|
-
const restoreResponse = await
|
|
145
|
+
const restoreResponse = await restoreRecord(recordModifyModel, context);
|
|
146
146
|
|
|
147
147
|
if (restoreResponse.status !== httpResponseStatusCodes.OK) {
|
|
148
148
|
throw new Error(`Failed to restore record "${recordId}"\n${restoreResponse.statusText}`);
|
|
@@ -158,7 +158,7 @@ module.exports = {
|
|
|
158
158
|
getContractorById,
|
|
159
159
|
getRecordHistory,
|
|
160
160
|
archiveByContractorId,
|
|
161
|
-
|
|
161
|
+
restoreRecord,
|
|
162
162
|
editContractor,
|
|
163
163
|
updateInviteDate,
|
|
164
164
|
updateExpiryDate,
|
|
@@ -98,6 +98,13 @@ const getTabTenantRequestsInProject = async (projectId, context) => {
|
|
|
98
98
|
return response.data;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
const getRequestFromTabByRecordId = async (recordId, tabId, context) => {
|
|
102
|
+
const { data: requestsInTab } = await requestsAPI.getRequestsByTabId(tabId, context);
|
|
103
|
+
const request = requestsInTab.find(({ record }) => record.contractorId === recordId);
|
|
104
|
+
|
|
105
|
+
return request;
|
|
106
|
+
};
|
|
107
|
+
|
|
101
108
|
module.exports = {
|
|
102
109
|
createRequest,
|
|
103
110
|
getAutocompleteAutoSelect,
|
|
@@ -110,5 +117,6 @@ module.exports = {
|
|
|
110
117
|
getOrCreateRequest,
|
|
111
118
|
getCreateRequestModel,
|
|
112
119
|
requestsGlobalSearch,
|
|
113
|
-
getTabTenantRequestsInProject
|
|
120
|
+
getTabTenantRequestsInProject,
|
|
121
|
+
getRequestFromTabByRecordId
|
|
114
122
|
};
|