@getjones/test-infra 2.12.1 → 2.12.2
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 +0 -7
- package/src/saas/internal-api/contractors/api/contractors.service.js +9 -8
- package/src/saas/internal-api/contractors/index.js +1 -2
- package/src/saas/internal-api/contractors/utils.js +25 -0
- package/src/saas/internal-api/users/api/users.api.js +6 -0
- package/src/saas/internal-api/users/api/users.service.js +6 -1
- package/src/saas/internal-api/contractors/models/create.contractor.model.js +0 -22
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,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
2
|
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
const { convertDateStringFormatToISOString } = require('../../../../common/utils/timeUtils');
|
|
4
3
|
|
|
5
4
|
const Endpoints = {
|
|
6
|
-
create: `${backendUrl}/saas/contractors/invite`,
|
|
7
5
|
get: `${backendUrl}/saas/contractors`,
|
|
8
6
|
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
9
7
|
getRecordHistory: contractorId => `${backendUrl}/saas/record/${contractorId}/history`,
|
|
@@ -29,10 +27,6 @@ const Endpoints = {
|
|
|
29
27
|
verifyInviteLink: encryptedData => `${backendUrl}/vendor-app/verify-link?data=${encryptedData}`
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
const createContractor = (createContractorModel, context) => {
|
|
33
|
-
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
30
|
const getContractorsByAccountId = (params, context) => {
|
|
37
31
|
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
38
32
|
};
|
|
@@ -139,7 +133,6 @@ const getInviteLinkStatus = (encryptedData, context) => {
|
|
|
139
133
|
};
|
|
140
134
|
|
|
141
135
|
module.exports = {
|
|
142
|
-
createContractor,
|
|
143
136
|
changeRequirement,
|
|
144
137
|
assignRequirement,
|
|
145
138
|
getContractorsByAccountId,
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
const contractorsAPI = require('./contractors.api');
|
|
2
|
-
const { CreateContractorModel } = require('../models/create.contractor.model');
|
|
3
2
|
const { RequestModel } = require('../../requests/models/edit.request.model');
|
|
4
3
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
4
|
const { RecordModifyDateVerificationModel } = require('../models/verification.contractor.model');
|
|
6
5
|
const { AssignRequirementModel } = require('../models/assign.requirement.model');
|
|
6
|
+
const { ContractorDetailsModel } = require('../models/edit.contractor.model');
|
|
7
7
|
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
8
8
|
const { waitFor } = require('../../../../common/utils/timeUtils');
|
|
9
|
-
|
|
10
|
-
const createContractor = async (createContractorModel, context) => {
|
|
11
|
-
validateType(createContractorModel, CreateContractorModel);
|
|
12
|
-
return contractorsAPI.createContractor(createContractorModel, context);
|
|
13
|
-
};
|
|
9
|
+
const utils = require('../utils');
|
|
14
10
|
|
|
15
11
|
const getContractorsByAccountId = async (accountId, context, activationStatus = null) => {
|
|
16
12
|
if (activationStatus) {
|
|
@@ -178,8 +174,12 @@ const getInviteLinkStatus = (encryptedData, context) => {
|
|
|
178
174
|
return contractorsAPI.getInviteLinkStatus(encryptedData, context);
|
|
179
175
|
};
|
|
180
176
|
|
|
177
|
+
const getContractorDetailsModel = recordConfig => {
|
|
178
|
+
const apiDetailsConfig = utils.getRecordDetailsConfigInApiFormat(recordConfig);
|
|
179
|
+
return new ContractorDetailsModel(apiDetailsConfig);
|
|
180
|
+
};
|
|
181
|
+
|
|
181
182
|
module.exports = {
|
|
182
|
-
createContractor,
|
|
183
183
|
changeRequirement,
|
|
184
184
|
getContractorsByAccountId,
|
|
185
185
|
getContractorById,
|
|
@@ -207,5 +207,6 @@ module.exports = {
|
|
|
207
207
|
archiveByRecordId,
|
|
208
208
|
restoreByRecordId,
|
|
209
209
|
updateLastInviteActionDate,
|
|
210
|
-
getInviteLinkStatus
|
|
210
|
+
getInviteLinkStatus,
|
|
211
|
+
getContractorDetailsModel
|
|
211
212
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const createModel = require('./models/create.contractor.model');
|
|
2
1
|
const editModel = require('./models/edit.contractor.model');
|
|
3
2
|
const verificationModel = require('./models/verification.contractor.model');
|
|
4
3
|
const assignRequirementModel = require('./models/assign.requirement.model');
|
|
5
4
|
const services = require('./api/contractors.service');
|
|
6
5
|
|
|
7
|
-
const models = {
|
|
6
|
+
const models = { edit: editModel, verification: verificationModel, assignRequirementModel };
|
|
8
7
|
|
|
9
8
|
module.exports = { services, models };
|
|
@@ -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 };
|
|
@@ -10,6 +10,7 @@ const Endpoints = {
|
|
|
10
10
|
`${backendUrl}/saas/project/${projectId}/team-members`,
|
|
11
11
|
getByEmail: email => `${backendUrl}/saas/team-member/by-email/${email}`,
|
|
12
12
|
delete: userId => `${backendUrl}/saas/users/${userId}`,
|
|
13
|
+
getUserListByRecordId: recordId => `${backendUrl}/saas/users/record/${recordId}`,
|
|
13
14
|
deleteSingleProject: (userId, projectId) => `${backendUrl}/saas/project/${projectId}/sub-account/${userId}`,
|
|
14
15
|
reinvite: `${backendUrl}/saas/project/team-member/reinvite`,
|
|
15
16
|
getUserEncryptedData: (email, userRole) => `${backendUrl}/saas/team-member/email/${email}/role/${userRole}/signup-data`,
|
|
@@ -89,12 +90,17 @@ const editUserProfile = (editUserProfileModel, context) => {
|
|
|
89
90
|
return requests.postRequestHandler(Endpoints.editUserProfile, editUserProfileModel, context);
|
|
90
91
|
};
|
|
91
92
|
|
|
93
|
+
const getUserListByRecordId = (recordId, context, { searchTerm } = {}) => {
|
|
94
|
+
return requests.getRequestHandler(Endpoints.getUserListByRecordId(recordId), { searchTerm }, context);
|
|
95
|
+
};
|
|
96
|
+
|
|
92
97
|
module.exports = {
|
|
93
98
|
invite,
|
|
94
99
|
signupUser,
|
|
95
100
|
getUsersByProjectId,
|
|
96
101
|
getUserByEmail,
|
|
97
102
|
getUserEncryptedData,
|
|
103
|
+
getUserListByRecordId,
|
|
98
104
|
deleteUser,
|
|
99
105
|
deleteUserFromSingleProject,
|
|
100
106
|
removeAllUserTraceFromDb,
|
|
@@ -176,6 +176,10 @@ const editUserSettings = async (email, config, userContext) => {
|
|
|
176
176
|
return getUserByEmail(email, systemUserContext);
|
|
177
177
|
};
|
|
178
178
|
|
|
179
|
+
const getUserListByRecordId = async (recordId, context, { searchTerm } = {}) => {
|
|
180
|
+
return userAPI.getUserListByRecordId(recordId, context, { searchTerm });
|
|
181
|
+
};
|
|
182
|
+
|
|
179
183
|
module.exports = {
|
|
180
184
|
inviteUser,
|
|
181
185
|
signupUser,
|
|
@@ -194,5 +198,6 @@ module.exports = {
|
|
|
194
198
|
getOrCreateInnerSystemUser,
|
|
195
199
|
editUserProfile,
|
|
196
200
|
editUserSettings,
|
|
197
|
-
getInnerSystemUserByEmail
|
|
201
|
+
getInnerSystemUserByEmail,
|
|
202
|
+
getUserListByRecordId
|
|
198
203
|
};
|
|
@@ -1,22 +0,0 @@
|
|
|
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 };
|