@getjones/test-infra 1.2.5 → 1.2.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/common/requests/apiKeyAuth/requests.js +38 -0
- package/src/common/requests/cookieAuth/requests.js +40 -0
- package/src/common/requests/requestHandlers.js +60 -0
- package/src/common/validations/errorValidation.js +10 -10
- package/src/common/validations/typeValidations.js +4 -4
- package/src/index.js +7 -3
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +14 -14
- package/src/saas/internal-api/accounts/api/core/accounts.core.setup.js +36 -36
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +27 -27
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.setup.js +35 -35
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +8 -8
- package/src/saas/internal-api/accounts/api/settings/settings.setup.js +9 -9
- package/src/saas/internal-api/accounts/index.js +4 -4
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +8 -9
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +11 -11
- package/src/saas/internal-api/auth/api/auth.api.js +4 -4
- package/src/saas/internal-api/auth/api/auth.setup.js +31 -22
- package/src/saas/internal-api/auth/index.js +1 -1
- package/src/saas/internal-api/coi/api/coi.api.js +14 -14
- package/src/saas/internal-api/coi/api/coi.setup.js +5 -5
- package/src/saas/internal-api/coi/index.js +1 -1
- package/src/saas/internal-api/coi/models/submit.coi.model.js +6 -6
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +11 -11
- package/src/saas/internal-api/compliance/api/audit/audit.setup.js +5 -5
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +6 -6
- package/src/saas/internal-api/compliance/api/convert/convert.setup.js +3 -3
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +15 -15
- package/src/saas/internal-api/compliance/api/coverage/coverage.setup.js +9 -9
- package/src/saas/internal-api/compliance/api/waive/waive.api.js +9 -11
- package/src/saas/internal-api/compliance/api/waive/waive.setup.js +5 -5
- package/src/saas/internal-api/compliance/index.js +15 -6
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +66 -66
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +28 -28
- package/src/saas/internal-api/contractors/api/contractors.api.js +42 -42
- package/src/saas/internal-api/contractors/api/contractors.setup.js +27 -27
- package/src/saas/internal-api/contractors/index.js +2 -2
- package/src/saas/internal-api/contractors/models/create.contractor.model.js +13 -13
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +66 -68
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +46 -0
- package/src/saas/internal-api/globalRecord/api/global.record.setup.js +57 -0
- package/src/saas/internal-api/globalRecord/index.js +4 -0
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +37 -0
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +4 -4
- package/src/saas/internal-api/homepageCharts/api/charts.setup.js +2 -2
- package/src/saas/internal-api/homepageCharts/index.js +1 -1
- package/src/saas/internal-api/projects/api/core/projects.api.js +13 -13
- package/src/saas/internal-api/projects/api/core/projects.setup.js +26 -26
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +6 -6
- package/src/saas/internal-api/projects/api/settings/project.settings.setup.js +5 -5
- package/src/saas/internal-api/projects/index.js +5 -5
- package/src/saas/internal-api/projects/models/core/create.project.model.js +19 -19
- package/src/saas/internal-api/projects/models/core/update.project.model.js +21 -21
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +27 -28
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +18 -18
- package/src/saas/internal-api/recordNotes/api/record.notes.setup.js +11 -11
- package/src/saas/internal-api/reports/api/reports.api.js +4 -4
- package/src/saas/internal-api/reports/api/reports.setup.js +2 -3
- package/src/saas/internal-api/reports/index.js +3 -3
- package/src/saas/internal-api/reports/models/report.model.js +23 -23
- package/src/saas/internal-api/requirements/api/requirements.api.js +11 -11
- package/src/saas/internal-api/requirements/api/requirements.setup.js +7 -7
- package/src/saas/internal-api/requirements/index.js +1 -1
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +27 -28
- package/src/saas/internal-api/tabs/api/tabs.api.js +1 -1
- package/src/saas/internal-api/tabs/index.js +1 -1
- package/src/saas/internal-api/thread-scheduler/runner.js +17 -0
- package/src/saas/internal-api/users/api/users.api.js +9 -9
- package/src/saas/internal-api/users/models/edit.user.model.js +6 -6
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +1 -1
- package/src/saas/openapi/accounts/accounts.api.js +5 -5
- package/src/saas/openapi/accounts/accounts.setup.js +4 -4
- package/src/saas/openapi/contractors/contractors.api.js +3 -3
- package/src/saas/openapi/contractors/contractors.setup.js +5 -5
- package/src/saas/openapi/projects/projects.api.js +25 -24
- package/src/saas/openapi/projects/projects.setup.js +15 -15
- package/src/saas/openapi/requirements/index.js +1 -1
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +7 -7
- package/src/saas/openapi/requirements/requirements.api.js +3 -4
- package/src/saas/openapi/requirements/requirements.setup.js +11 -11
- package/src/saas/openapi/tabs/tabs.api.js +4 -4
- package/src/saas/openapi/tabs/tabs.setup.js +2 -2
- package/src/saas/internal-api/common/requests.js +0 -71
- package/src/saas/openapi/common/requests.js +0 -74
- package/src/saas/thread-scheduler/runner.js +0 -17
|
@@ -1,91 +1,91 @@
|
|
|
1
1
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
2
2
|
|
|
3
3
|
const COI_AUDIT_STATUSES = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
NOT_AUDITED: '0',
|
|
5
|
+
REAUDIT: '3'
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const AUDIT_ENTITY_STATUSES = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
YES: 'Yes',
|
|
10
|
+
NO: 'No',
|
|
11
|
+
EMPTY: 'empty',
|
|
12
|
+
OTHER: 'other',
|
|
13
|
+
CLAIMS: 'Claims'
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const AUDIT_ATTRIBUTE_NAMES = {
|
|
17
|
-
|
|
17
|
+
CERTIFICATE_ISSUE_DATE: 'certIssueDate'
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const AUDIT_POLICY_NAMES = {
|
|
21
|
-
|
|
21
|
+
GENERAL_LIABILITY: ''
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const AUDITOR_ROLE = 'Auditor';
|
|
25
25
|
|
|
26
|
-
class AuditRequestModel{
|
|
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
|
-
|
|
26
|
+
class AuditRequestModel {
|
|
27
|
+
constructor(
|
|
28
|
+
accountId = null,
|
|
29
|
+
projectId = null,
|
|
30
|
+
requirementId = null,
|
|
31
|
+
contractorId = null,
|
|
32
|
+
certificateId = null,
|
|
33
|
+
auditorId = null,
|
|
34
|
+
auditEntities = null,
|
|
35
|
+
isReaudit = null,
|
|
36
|
+
isProjectOnboarding = false,
|
|
37
|
+
shouldSendNotificationToPM = true,
|
|
38
|
+
auditDates = {},
|
|
39
|
+
auditStatus = null,
|
|
40
|
+
auditorRole = AUDITOR_ROLE
|
|
41
|
+
) {
|
|
42
|
+
const auditData = {
|
|
43
|
+
userId: accountId,
|
|
44
|
+
projectId: projectId,
|
|
45
|
+
requirementId: requirementId,
|
|
46
|
+
contractorId: contractorId,
|
|
47
|
+
certificateId: certificateId,
|
|
48
|
+
auditorId: auditorId,
|
|
49
|
+
policyDetails: auditEntities,
|
|
50
|
+
auditorStatus: COI_AUDIT_STATUSES.NOT_AUDITED,
|
|
51
|
+
isReaudit: isReaudit,
|
|
52
|
+
projectOnboarding: isProjectOnboarding,
|
|
53
|
+
role: auditorRole,
|
|
54
|
+
sendNotificationToPM: shouldSendNotificationToPM,
|
|
55
|
+
auditStatus
|
|
56
|
+
};
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
validateType(auditDates, AuditDatesModel);
|
|
59
|
+
this.auditData = auditData;
|
|
60
|
+
this.auditDates = auditDates;
|
|
61
|
+
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
class AuditEntityModel {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
constructor(policyId, attributeName, status, value) {
|
|
66
|
+
this.contractorInsuranceId = policyId;
|
|
67
|
+
this.limitname = attributeName;
|
|
68
|
+
this.status = status;
|
|
69
|
+
this.value = value;
|
|
70
|
+
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
class AuditDatesModel{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
class AuditDatesModel {
|
|
74
|
+
constructor(contractorId, contractorDateModified, dateStartedAudit, contractorOverrideDateModified, contractCreateDate) {
|
|
75
|
+
this.contractorId = contractorId;
|
|
76
|
+
this.contractorDateModified = contractorDateModified;
|
|
77
|
+
this.dateStartedAudit = dateStartedAudit;
|
|
78
|
+
this.contractorOverrideDateModified = contractorOverrideDateModified;
|
|
79
|
+
this.contractCreateDate = contractCreateDate;
|
|
80
|
+
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
module.exports = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
};
|
|
84
|
+
AuditRequestModel,
|
|
85
|
+
AuditEntityModel,
|
|
86
|
+
AuditDatesModel,
|
|
87
|
+
COI_AUDIT_STATUSES,
|
|
88
|
+
AUDIT_ENTITY_STATUSES,
|
|
89
|
+
AUDIT_ATTRIBUTE_NAMES,
|
|
90
|
+
AUDIT_POLICY_NAMES
|
|
91
|
+
};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
const DEFAULT_USER_ROLE = 'ICS';
|
|
2
2
|
|
|
3
3
|
const WAIVE_ACTIONS = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
WAIVE: 'ignored',
|
|
5
|
+
RETRACT: 'notIgnored'
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const WAIVER_REASONS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
BUSINESS_DECISION: 'Business_Decision',
|
|
10
|
+
NO_EXPOSURE: 'No_Exposure',
|
|
11
|
+
EXECUTIVE_APPROVAL: 'Executive_Approval'
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
function WaiveRequestModel({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
userId,
|
|
16
|
+
contractorId,
|
|
17
|
+
auditId,
|
|
18
|
+
waiverReason,
|
|
19
|
+
remarks = '',
|
|
20
|
+
userRole = DEFAULT_USER_ROLE
|
|
21
21
|
}) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
this.auditorContractorId = auditId;
|
|
23
|
+
this.contractorId = contractorId;
|
|
24
|
+
this.userId = userId;
|
|
25
|
+
this.waiverReason = waiverReason;
|
|
26
|
+
this.remarks = remarks;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
this.userRole = userRole;
|
|
29
|
+
this.status = WAIVE_ACTIONS.WAIVE;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function RetractRequestModel({ userId, contractorId, auditId, userRole = DEFAULT_USER_ROLE }) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
this.auditorContractorId = auditId;
|
|
34
|
+
this.contractorId = contractorId;
|
|
35
|
+
this.userId = userId;
|
|
36
|
+
this.userRole = userRole;
|
|
37
|
+
this.status = WAIVE_ACTIONS.RETRACT;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
module.exports = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
41
|
+
WaiveRequestModel,
|
|
42
|
+
RetractRequestModel,
|
|
43
|
+
WAIVE_ACTIONS,
|
|
44
|
+
WAIVER_REASONS
|
|
45
|
+
};
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
const requests = require('
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
2
|
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
3
|
|
|
4
4
|
const Endpoints = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
create: `${backendUrl}/saas/contractors/invite`,
|
|
6
|
+
get: `${backendUrl}/saas/contractors`,
|
|
7
|
+
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
8
|
+
delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
9
|
+
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
10
|
+
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
11
|
+
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
12
|
+
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
13
|
+
assignMptToProperties: (accountId, tenantId) => `${backendUrl}/saas/account/${accountId}/multi-properties/${tenantId}`
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const createContractors = async (createContractorModel, context) => {
|
|
17
|
-
|
|
17
|
+
return requests.postRequestHandler(Endpoints.create, createContractorModel, context).then(res => res.data || res);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const getContractorsByAccountId = async (params, context) => {
|
|
21
|
-
|
|
21
|
+
return requests.getRequestHandler(Endpoints.get, params, context).then(res => res.data);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const getContractorById = async (contractorId, context) => {
|
|
25
|
-
|
|
25
|
+
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context).then(res => res.data);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const deleteByContractorId = async (contractorId, context) => {
|
|
29
|
-
|
|
29
|
+
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const archiveByContractorId = async (contractorId, context) => {
|
|
33
|
-
|
|
33
|
+
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const restoreByContractorId = async (contractorId, context) => {
|
|
37
|
-
|
|
37
|
+
return requests.postRequestHandler(Endpoints.restore(contractorId), {}, context);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const editContractor = async (editContractorModel, context) => {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const params = { updateInfoUser: 'EditVendor' };
|
|
42
|
+
return requests.postRequestHandler(Endpoints.edit(editContractorModel.contractorId), editContractorModel, context, {}, params).then(res => res.data);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const updateExpiryDate = async (contractorId, expiryDate, policyName) => {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const data = { [policyName]: expiryDate };
|
|
47
|
+
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
const assignMptToProperties = async (assignToMptModel, context) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
const params = { updateInfoUser: 'EditVendor' };
|
|
52
|
+
const response = await requests.postRequestHandler(
|
|
53
|
+
Endpoints.assignMptToProperties(assignToMptModel.accountId, assignToMptModel.tenantId),
|
|
54
|
+
assignToMptModel.properties,
|
|
55
|
+
context,
|
|
56
|
+
{},
|
|
57
|
+
params
|
|
58
|
+
);
|
|
59
|
+
return response;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
const getContractorsByTabId = async (tabId, context, activityStatus) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const body = { tabId, activityStatus };
|
|
64
|
+
const response = await requests.postRequestHandler(Endpoints.get, body, context);
|
|
65
|
+
return response.data;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
module.exports = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
createContractors,
|
|
70
|
+
getContractorsByAccountId,
|
|
71
|
+
getContractorById,
|
|
72
|
+
deleteByContractorId,
|
|
73
|
+
archiveByContractorId,
|
|
74
|
+
restoreByContractorId,
|
|
75
|
+
editContractor,
|
|
76
|
+
updateExpiryDate,
|
|
77
|
+
assignMptToProperties,
|
|
78
|
+
getContractorsByTabId
|
|
79
79
|
};
|
|
@@ -4,61 +4,61 @@ const { ContractorModel, MptModel } = require('../models/edit.contractor.model')
|
|
|
4
4
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
5
|
|
|
6
6
|
const createContractors = async (createContractorsModel, context) => {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
validateType(createContractorsModel, CreateContractorModel);
|
|
8
|
+
return contractorsAPI.createContractors(createContractorsModel, context);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const getContractorsByAccountId = async (accountId, context, activationStatus = null) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (activationStatus) {
|
|
13
|
+
activationStatus = activationStatus.reduce((f, s) => `${f},${s}`);
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
return contractorsAPI.getContractorsByAccountId({ accountId, activationStatus }, context);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const getContractorById = (contractorId, context) => {
|
|
20
|
-
|
|
20
|
+
return contractorsAPI.getContractorById(contractorId, context);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const deleteByContractorId = (contractorId, context) => {
|
|
24
|
-
|
|
24
|
+
return contractorsAPI.deleteByContractorId(contractorId, context);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const archiveByContractorId = (contractorId, context) => {
|
|
28
|
-
|
|
28
|
+
return contractorsAPI.archiveByContractorId(contractorId, context);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const restoreByContractorId = (contractorId, context) => {
|
|
32
|
-
|
|
32
|
+
return contractorsAPI.restoreByContractorId(contractorId, context);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const editContractor = (editContractorModel, context) => {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
validateType(editContractorModel, ContractorModel);
|
|
37
|
+
return contractorsAPI.editContractor(editContractorModel, context);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
41
|
-
|
|
41
|
+
return contractorsAPI.updateExpiryDate(contractorId, expiryDate, policyName);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const getContractorsByTabId = (tabId, context, activityStatus = 'ACTIVE') => {
|
|
45
|
-
|
|
45
|
+
return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
const assignMptToProperties = (assignToMptModel, context) => {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
validateType(assignToMptModel, MptModel);
|
|
50
|
+
return contractorsAPI.assignMptToProperties(assignToMptModel, context);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
module.exports = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
54
|
+
createContractors,
|
|
55
|
+
getContractorsByAccountId,
|
|
56
|
+
getContractorById,
|
|
57
|
+
deleteByContractorId,
|
|
58
|
+
archiveByContractorId,
|
|
59
|
+
restoreByContractorId,
|
|
60
|
+
editContractor,
|
|
61
|
+
updateExpiryDate,
|
|
62
|
+
getContractorsByTabId,
|
|
63
|
+
assignMptToProperties
|
|
64
|
+
};
|
|
@@ -2,6 +2,6 @@ const createModel = require('./models/create.contractor.model');
|
|
|
2
2
|
const editModel = require('./models/edit.contractor.model');
|
|
3
3
|
const services = require('./api/contractors.setup');
|
|
4
4
|
|
|
5
|
-
const models = { create: createModel, edit:editModel };
|
|
5
|
+
const models = { create: createModel, edit: editModel };
|
|
6
6
|
|
|
7
|
-
module.exports = { services, models };
|
|
7
|
+
module.exports = { services, models };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
2
2
|
|
|
3
3
|
function CreateContractorModel(requirementId, inviterEmail, vendorsInfo, { tabId = null, disableMail = true, sendCovid19Form = false } = {}) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
this.reqId = requirementId;
|
|
5
|
+
this.inviterEmail = inviterEmail;
|
|
6
|
+
this.vendorInfo = vendorsInfo;
|
|
7
|
+
this.disableMail = disableMail;
|
|
8
|
+
this.sendCovid19Form = sendCovid19Form;
|
|
9
|
+
this.tabId = tabId;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
validateType(vendorsInfo, Array);
|
|
12
|
+
vendorsInfo && validateType(vendorsInfo[0], ContractorInfo);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function ContractorInfo(email, companyName, additionalEmails) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
this.email = email;
|
|
17
|
+
this.companyName = companyName;
|
|
18
|
+
this.title = email;
|
|
19
|
+
this.additionalEmails = additionalEmails;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
module.exports = { CreateContractorModel, ContractorInfo };
|
|
22
|
+
module.exports = { CreateContractorModel, ContractorInfo };
|
|
@@ -1,92 +1,90 @@
|
|
|
1
1
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
2
2
|
|
|
3
3
|
class ContractorModel {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
constructor(contractorId, company, emailAddress, tab, additionalDetails) {
|
|
5
|
+
validateType(tab, VendorTabModel);
|
|
6
|
+
validateType(additionalDetails, ContractorDetailsModel);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
this.contractorId = contractorId;
|
|
9
|
+
this.company = company;
|
|
10
|
+
this.emailAddress = emailAddress;
|
|
11
|
+
this.tab = tab;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
13
|
+
for (const detail in additionalDetails) {
|
|
14
|
+
if (additionalDetails[detail]) {
|
|
15
|
+
this[detail] = additionalDetails[detail];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
class ContractorDetailsModel {
|
|
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
|
-
Object.keys(tenantRecord).length && validateType(tenantRecord, TenantRecordModel);
|
|
53
|
-
this.tenantRecord = tenantRecord;
|
|
22
|
+
constructor({
|
|
23
|
+
additionalEmails = [],
|
|
24
|
+
dba = null,
|
|
25
|
+
firstName = null,
|
|
26
|
+
lastName = null,
|
|
27
|
+
address = null,
|
|
28
|
+
city = null,
|
|
29
|
+
state = null,
|
|
30
|
+
zipCode = null,
|
|
31
|
+
phoneNumber = null,
|
|
32
|
+
recordId = null,
|
|
33
|
+
projectDescription = null,
|
|
34
|
+
startDate = null,
|
|
35
|
+
endDate = null,
|
|
36
|
+
tenantRecord = {}
|
|
37
|
+
} = {}) {
|
|
38
|
+
this.dba = dba;
|
|
39
|
+
this.fName = firstName;
|
|
40
|
+
this.lName = lastName;
|
|
41
|
+
this.location = address;
|
|
42
|
+
this.city = city;
|
|
43
|
+
this.state = state;
|
|
44
|
+
this.zipCode = zipCode;
|
|
45
|
+
this.phoneNumber = phoneNumber;
|
|
46
|
+
this.externalRecordId = recordId;
|
|
47
|
+
this.descriptionOfOperations = projectDescription;
|
|
48
|
+
this.startDate = startDate;
|
|
49
|
+
this.endDate = endDate;
|
|
54
50
|
|
|
55
|
-
|
|
51
|
+
Object.keys(tenantRecord).length && validateType(tenantRecord, TenantRecordModel);
|
|
52
|
+
this.tenantRecord = tenantRecord;
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
this.additionalEmails.push(typeof email === 'string' ? { email: email } : email );
|
|
59
|
-
}
|
|
54
|
+
this.additionalEmails = [];
|
|
60
55
|
|
|
61
|
-
|
|
56
|
+
for (const email of additionalEmails) {
|
|
57
|
+
this.additionalEmails.push(typeof email === 'string' ? { email: email } : email);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
class TenantRecordModel {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
constructor(id, companyName, emailAddress) {
|
|
64
|
+
this.id = id;
|
|
65
|
+
this.companyName = companyName;
|
|
66
|
+
this.emailAddress = emailAddress;
|
|
67
|
+
}
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
class VendorTabModel {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
constructor(type) {
|
|
72
|
+
this.type = type;
|
|
73
|
+
}
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
class MptModel {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
constructor(accountId, tenantId, properties) {
|
|
78
|
+
this.accountId = accountId;
|
|
79
|
+
this.tenantId = tenantId;
|
|
80
|
+
this.properties = properties;
|
|
81
|
+
}
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
module.exports = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
ContractorModel,
|
|
86
|
+
TenantRecordModel,
|
|
87
|
+
VendorTabModel,
|
|
88
|
+
ContractorDetailsModel,
|
|
89
|
+
MptModel
|
|
92
90
|
};
|