@getjones/test-infra 2.11.9 → 2.12.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 +1 -1
- package/src/defaults/configs/polices.js +3 -0
- package/src/factory/records/records.js +1 -1
- package/src/saas/internal-api/contractors/api/contractors.api.js +3 -3
- package/src/saas/internal-api/contractors/api/contractors.service.js +25 -4
- package/src/saas/internal-api/contractors/utils.js +25 -0
package/package.json
CHANGED
|
@@ -43,6 +43,9 @@ const attributeNames = {
|
|
|
43
43
|
occur: 'Occur',
|
|
44
44
|
text: 'text',
|
|
45
45
|
limit: 'limit',
|
|
46
|
+
AdditionalInsuredEndorsement: 'Additional Insured Endorsement',
|
|
47
|
+
PrimaryNonContributoryProvision: 'Primary Non-Contributory Provision',
|
|
48
|
+
PrimaryNonContributoryEndorsement: 'Primary Non-Contributory Endorsement',
|
|
46
49
|
indemnityPeriod: 'Indemnity Period',
|
|
47
50
|
actualLossSustained: 'Actual Loss Sustained',
|
|
48
51
|
extraExpense: 'Extra Expense'
|
|
@@ -37,7 +37,7 @@ const prepareRecord = async (recordCompany, recordEmail, status, tabId, requirem
|
|
|
37
37
|
|
|
38
38
|
if (recordConfig) {
|
|
39
39
|
const tabModel = new requests.models.TabModel(requestData.tab.type);
|
|
40
|
-
const recordDetailsModel =
|
|
40
|
+
const recordDetailsModel = contractors.services.getContractorDetailsModel(recordConfig);
|
|
41
41
|
const record = new contractors.models.edit.ContractorModel(
|
|
42
42
|
recordId,
|
|
43
43
|
requestData.record.recordType,
|
|
@@ -49,8 +49,8 @@ const deleteByContractorId = (contractorId, context) => {
|
|
|
49
49
|
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const
|
|
53
|
-
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
52
|
+
const archiveRecord = (recordVerificationModel, context) => {
|
|
53
|
+
return requests.deleteRequestHandler(Endpoints.archive(recordVerificationModel.contractorId), context, {}, {}, recordVerificationModel);
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
const restoreRecord = (recordVerificationModel, context) => {
|
|
@@ -146,7 +146,7 @@ module.exports = {
|
|
|
146
146
|
getContractorById,
|
|
147
147
|
getRecordHistory,
|
|
148
148
|
deleteByContractorId,
|
|
149
|
-
|
|
149
|
+
archiveRecord,
|
|
150
150
|
restoreRecord,
|
|
151
151
|
editContractor,
|
|
152
152
|
updateInviteDate,
|
|
@@ -4,8 +4,10 @@ const { RequestModel } = require('../../requests/models/edit.request.model');
|
|
|
4
4
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
5
|
const { RecordModifyDateVerificationModel } = require('../models/verification.contractor.model');
|
|
6
6
|
const { AssignRequirementModel } = require('../models/assign.requirement.model');
|
|
7
|
+
const { ContractorDetailsModel } = require('../models/edit.contractor.model');
|
|
7
8
|
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
8
9
|
const { waitFor } = require('../../../../common/utils/timeUtils');
|
|
10
|
+
const utils = require('../utils');
|
|
9
11
|
|
|
10
12
|
const createContractor = async (createContractorModel, context) => {
|
|
11
13
|
validateType(createContractorModel, CreateContractorModel);
|
|
@@ -28,8 +30,9 @@ const getRecordHistory = (contractorId, context) => {
|
|
|
28
30
|
return contractorsAPI.getRecordHistory(contractorId, context);
|
|
29
31
|
};
|
|
30
32
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
+
const archiveRecord = (recordVerificationModel, context) => {
|
|
34
|
+
validateType(recordVerificationModel, RecordModifyDateVerificationModel);
|
|
35
|
+
return contractorsAPI.archiveRecord(recordVerificationModel, context);
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
const restoreRecord = (recordVerificationModel, context) => {
|
|
@@ -162,17 +165,33 @@ const restoreByRecordId = async (recordId, context) => {
|
|
|
162
165
|
return restoreResponse;
|
|
163
166
|
};
|
|
164
167
|
|
|
168
|
+
const archiveByRecordId = async (recordId, context) => {
|
|
169
|
+
const recordModifyModel = await getRecordVerificationModel(recordId, context);
|
|
170
|
+
const archiveResponse = await archiveRecord(recordModifyModel, context);
|
|
171
|
+
|
|
172
|
+
if (archiveResponse.status !== httpResponseStatusCodes.OK) {
|
|
173
|
+
throw new Error(`Failed to archive record "${recordId}"\n${archiveResponse.statusText}`);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return archiveResponse;
|
|
177
|
+
};
|
|
178
|
+
|
|
165
179
|
const getInviteLinkStatus = (encryptedData, context) => {
|
|
166
180
|
return contractorsAPI.getInviteLinkStatus(encryptedData, context);
|
|
167
181
|
};
|
|
168
182
|
|
|
183
|
+
const getContractorDetailsModel = recordConfig => {
|
|
184
|
+
const apiDetailsConfig = utils.getRecordDetailsConfigInApiFormat(recordConfig);
|
|
185
|
+
return new ContractorDetailsModel(apiDetailsConfig);
|
|
186
|
+
};
|
|
187
|
+
|
|
169
188
|
module.exports = {
|
|
170
189
|
createContractor,
|
|
171
190
|
changeRequirement,
|
|
172
191
|
getContractorsByAccountId,
|
|
173
192
|
getContractorById,
|
|
174
193
|
getRecordHistory,
|
|
175
|
-
|
|
194
|
+
archiveRecord,
|
|
176
195
|
restoreRecord,
|
|
177
196
|
editContractor,
|
|
178
197
|
updateInviteDate,
|
|
@@ -192,7 +211,9 @@ module.exports = {
|
|
|
192
211
|
assignRequirement,
|
|
193
212
|
getAssignRequirementModel,
|
|
194
213
|
getLinkedProjectsCount,
|
|
214
|
+
archiveByRecordId,
|
|
195
215
|
restoreByRecordId,
|
|
196
216
|
updateLastInviteActionDate,
|
|
197
|
-
getInviteLinkStatus
|
|
217
|
+
getInviteLinkStatus,
|
|
218
|
+
getContractorDetailsModel
|
|
198
219
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const getRecordDetailsConfigInApiFormat = function(config) {
|
|
2
|
+
apiConfig = {};
|
|
3
|
+
apiConfig['company'] = config['Company Name'] || config.companyName || config.company;
|
|
4
|
+
apiConfig['emailAddress'] = config['Primary Email'] || config['Email Address'] || config['emailAddress'] || config['email'];
|
|
5
|
+
apiConfig['firstName'] = config['First Name'] || config.firstName || config.fName;
|
|
6
|
+
apiConfig['lastName'] = config['Last Name'] || config.lastName || config.lName;
|
|
7
|
+
apiConfig['dba'] = config['DBA'] || config['DBA (Optional)'] || config.dba;
|
|
8
|
+
apiConfig['address'] = config['Address'] || config.address || config.location;
|
|
9
|
+
apiConfig['city'] = config['City'] || config.city;
|
|
10
|
+
apiConfig['state'] = config['State'] || config.state;
|
|
11
|
+
apiConfig['zipCode'] = config['Zip Code'] || config.zipCode;
|
|
12
|
+
apiConfig['phoneNumber'] = config['Phone Number'] || config['Phone Number (Optional)'] || config.phoneNumber || config.phone;
|
|
13
|
+
apiConfig['externalRecordId'] = config['Record ID'] || config.recordId || config.externalRecordId;
|
|
14
|
+
apiConfig['projectDescription'] = config['Project Description'] || config.projectDescription || config.descriptionOfOperations;
|
|
15
|
+
apiConfig['startDate'] = config['Start Date'] || config.startDate;
|
|
16
|
+
apiConfig['endDate'] = config['End Date'] || config.endDate;
|
|
17
|
+
apiConfig['additionalEmails'] = config['Additional Emails'] || config.additionalEmails;
|
|
18
|
+
apiConfig['tenantBusinessName'] = config['Tenant Company Name'] || config.tenantCompanyName || config.tenantBusinessName;
|
|
19
|
+
apiConfig['tenantEmailAddress'] = config['Tenant Email Address'] || config.tenantEmailAddress;
|
|
20
|
+
|
|
21
|
+
Object.keys(apiConfig).forEach(key => apiConfig[key] === undefined && delete apiConfig[key]);
|
|
22
|
+
return apiConfig;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
module.exports = { getRecordDetailsConfigInApiFormat };
|