@getjones/test-infra 2.8.5 → 2.8.6
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/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 +12 -13
- package/src/saas/internal-api/contractors/api/contractors.service.js +9 -21
- package/src/saas/internal-api/requests/api/requests.service.js +9 -1
package/package.json
CHANGED
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
|
+
audit: agreementConsts
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = { services, models, consts };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { UPLOADER_TYPE } = require('../consts/consts');
|
|
2
|
+
|
|
3
|
+
class CreateAgreementModel {
|
|
4
|
+
constructor({ contractorId, contractorDateModified, uploaderId, signedContractName, uploaderType = UPLOADER_TYPE.USER }) {
|
|
5
|
+
this.contractorId = contractorId;
|
|
6
|
+
this.contractorDateModified = contractorDateModified;
|
|
7
|
+
this.uploaderId = uploaderId;
|
|
8
|
+
this.signedContractName = signedContractName;
|
|
9
|
+
this.uploaderType = uploaderType;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
module.exports = { CreateAgreementModel };
|
|
@@ -11,9 +11,9 @@ const Endpoints = {
|
|
|
11
11
|
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
12
12
|
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
13
|
sendGaps: `${backendUrl}/saas/contractor/compliance/status`,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
|
@@ -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
79
|
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
80
80
|
return requests.postRequestHandler(Endpoints.sendGaps, 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) => {
|
|
@@ -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) => {
|
|
@@ -76,19 +76,19 @@ const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
|
76
76
|
return contractorsAPI.sendGaps(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) => {
|
|
@@ -140,17 +140,6 @@ const getLinkedProjectsCount = (recordId, context) => {
|
|
|
140
140
|
return contractorsAPI.getLinkedProjectsCount(recordId, context);
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
const restoreByRecordId = async (recordId, context) => {
|
|
144
|
-
const recordModifyModel = await getRecordVerificationModel(recordId, context);
|
|
145
|
-
const restoreResponse = await restoreContractor(recordModifyModel, context);
|
|
146
|
-
|
|
147
|
-
if (restoreResponse.status !== httpResponseStatusCodes.OK) {
|
|
148
|
-
throw new Error(`Failed to restore record "${recordId}"\n${restoreResponse.statusText}`);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return restoreResponse;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
143
|
module.exports = {
|
|
155
144
|
createContractor,
|
|
156
145
|
changeRequirement,
|
|
@@ -176,6 +165,5 @@ module.exports = {
|
|
|
176
165
|
getRecordVerificationModel,
|
|
177
166
|
assignRequirement,
|
|
178
167
|
getAssignRequirementModel,
|
|
179
|
-
getLinkedProjectsCount
|
|
180
|
-
restoreByRecordId
|
|
168
|
+
getLinkedProjectsCount
|
|
181
169
|
};
|
|
@@ -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
|
};
|