@getjones/test-infra 1.9.0 → 1.11.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 +29 -29
- package/src/common/factory/index.js +3 -0
- package/src/common/factory/records/records.js +45 -0
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/requests/apiKeyAuth/requests.js +38 -38
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/requestHandlers.js +60 -60
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/timeUtils.js +147 -0
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/env.js +45 -44
- package/src/index.js +67 -67
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +28 -28
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +77 -77
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +24 -24
- package/src/saas/internal-api/accounts/index.js +20 -20
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +15 -15
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +19 -19
- package/src/saas/internal-api/accounts/utils/utils.js +32 -32
- package/src/saas/internal-api/auth/api/auth.api.js +12 -12
- package/src/saas/internal-api/auth/api/auth.service.js +47 -47
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +34 -34
- package/src/saas/internal-api/coi/api/coi.service.js +22 -22
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +7 -7
- package/src/saas/internal-api/coi/index.js +13 -13
- package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
- package/src/saas/internal-api/coi/utils/utils.js +48 -48
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +40 -40
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +33 -33
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +24 -24
- package/src/saas/internal-api/compliance/api/waive/waive.api.js +21 -21
- package/src/saas/internal-api/compliance/api/waive/waive.service.js +15 -15
- package/src/saas/internal-api/compliance/index.js +22 -22
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +110 -110
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +45 -45
- package/src/saas/internal-api/contractors/api/contractors.api.js +159 -165
- package/src/saas/internal-api/contractors/api/contractors.service.js +136 -141
- package/src/saas/internal-api/contractors/index.js +8 -8
- package/src/saas/internal-api/contractors/models/create.contractor.model.js +22 -22
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +69 -91
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -33
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -0
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +19 -0
- package/src/saas/internal-api/dbEmails/index.js +3 -0
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +21 -0
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +76 -76
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +83 -83
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +43 -43
- package/src/saas/internal-api/globalRecord/utils/util.js +148 -148
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +17 -17
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +39 -39
- package/src/saas/internal-api/projects/utils/utils.js +82 -82
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +29 -29
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/reports/api/reports.api.js +39 -39
- package/src/saas/internal-api/reports/api/reports.service.js +34 -34
- package/src/saas/internal-api/reports/consts/consts.js +63 -63
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +28 -21
- package/src/saas/internal-api/requests/api/requests.service.js +19 -14
- package/src/saas/internal-api/requests/index.js +11 -3
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -0
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -0
- package/src/saas/internal-api/requests/models/validation.models.js +8 -0
- package/src/saas/internal-api/requirements/api/requirements.api.js +27 -27
- package/src/saas/internal-api/requirements/api/requirements.service.js +23 -23
- package/src/saas/internal-api/requirements/index.js +6 -6
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +45 -45
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +18 -18
- package/src/saas/internal-api/thread-scheduler/runner.js +13 -13
- package/src/saas/internal-api/users/api/users.api.js +78 -78
- package/src/saas/internal-api/users/api/users.service.js +101 -101
- package/src/saas/internal-api/users/index.js +4 -4
- package/src/saas/internal-api/users/models/users.model.js +31 -31
- package/src/saas/internal-api/users/utils/util.js +14 -14
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/contractors/contractors.api.js +20 -20
- package/src/saas/openapi/contractors/contractors.service.js +18 -18
- package/src/saas/openapi/contractors/index.js +6 -6
- package/src/saas/openapi/contractors/models/invite.contractor.model.js +37 -37
- package/src/saas/openapi/projects/projects.api.js +59 -59
- package/src/saas/openapi/projects/projects.service.js +44 -44
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +12 -12
- package/src/saas/openapi/requirements/requirements.service.js +20 -20
- package/src/saas/openapi/tabs/tabs.api.js +13 -13
- package/src/saas/openapi/tabs/tabs.service.js +7 -7
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
- package/src/common/utils/dateUtils.js +0 -6
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
const { validateType, validateInteger, validateArray, validateDateString } = require('../../../../../common/validations/typeValidations');
|
|
2
|
-
|
|
3
|
-
const COI_AUDIT_STATUSES = {
|
|
4
|
-
NOT_AUDITED: '0',
|
|
5
|
-
REAUDIT: '3'
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const AUDIT_ENTITY_STATUSES = {
|
|
9
|
-
YES: 'Yes',
|
|
10
|
-
NO: 'No',
|
|
11
|
-
EMPTY: 'empty',
|
|
12
|
-
OTHER: 'other',
|
|
13
|
-
CLAIMS: 'Claims'
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const AUDIT_ATTRIBUTE_NAMES = {
|
|
17
|
-
CERTIFICATE_ISSUE_DATE: 'certIssueDate'
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const AUDIT_POLICY_NAMES = {
|
|
21
|
-
GENERAL_LIABILITY: ''
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const AUDITOR_ROLE = 'Auditor';
|
|
25
|
-
|
|
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
|
-
|
|
58
|
-
validateType(auditDates, AuditDatesModel);
|
|
59
|
-
this.auditData = auditData;
|
|
60
|
-
this.auditDates = auditDates;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
class AuditEntityModel {
|
|
65
|
-
constructor(policyId, attributeName, status, value) {
|
|
66
|
-
this.contractorInsuranceId = policyId;
|
|
67
|
-
this.limitname = attributeName;
|
|
68
|
-
this.status = status;
|
|
69
|
-
this.value = value;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
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
|
-
}
|
|
82
|
-
|
|
83
|
-
class AuditListParametersModel {
|
|
84
|
-
constructor(page, accountIds, { fromDate, toDate } = {}) {
|
|
85
|
-
validateInteger(page, { min: 1 });
|
|
86
|
-
validateArray(accountIds);
|
|
87
|
-
|
|
88
|
-
if (fromDate) {
|
|
89
|
-
validateDateString(fromDate);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (toDate) {
|
|
93
|
-
validateDateString(toDate);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
this.page = page;
|
|
97
|
-
this.filters = { accountIds, fromDate, toDate };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
module.exports = {
|
|
102
|
-
AuditRequestModel,
|
|
103
|
-
AuditEntityModel,
|
|
104
|
-
AuditDatesModel,
|
|
105
|
-
AuditListParametersModel,
|
|
106
|
-
COI_AUDIT_STATUSES,
|
|
107
|
-
AUDIT_ENTITY_STATUSES,
|
|
108
|
-
AUDIT_ATTRIBUTE_NAMES,
|
|
109
|
-
AUDIT_POLICY_NAMES
|
|
110
|
-
};
|
|
1
|
+
const { validateType, validateInteger, validateArray, validateDateString } = require('../../../../../common/validations/typeValidations');
|
|
2
|
+
|
|
3
|
+
const COI_AUDIT_STATUSES = {
|
|
4
|
+
NOT_AUDITED: '0',
|
|
5
|
+
REAUDIT: '3'
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const AUDIT_ENTITY_STATUSES = {
|
|
9
|
+
YES: 'Yes',
|
|
10
|
+
NO: 'No',
|
|
11
|
+
EMPTY: 'empty',
|
|
12
|
+
OTHER: 'other',
|
|
13
|
+
CLAIMS: 'Claims'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const AUDIT_ATTRIBUTE_NAMES = {
|
|
17
|
+
CERTIFICATE_ISSUE_DATE: 'certIssueDate'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const AUDIT_POLICY_NAMES = {
|
|
21
|
+
GENERAL_LIABILITY: ''
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const AUDITOR_ROLE = 'Auditor';
|
|
25
|
+
|
|
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
|
+
|
|
58
|
+
validateType(auditDates, AuditDatesModel);
|
|
59
|
+
this.auditData = auditData;
|
|
60
|
+
this.auditDates = auditDates;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
class AuditEntityModel {
|
|
65
|
+
constructor(policyId, attributeName, status, value) {
|
|
66
|
+
this.contractorInsuranceId = policyId;
|
|
67
|
+
this.limitname = attributeName;
|
|
68
|
+
this.status = status;
|
|
69
|
+
this.value = value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
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
|
+
}
|
|
82
|
+
|
|
83
|
+
class AuditListParametersModel {
|
|
84
|
+
constructor(page, accountIds, { fromDate, toDate } = {}) {
|
|
85
|
+
validateInteger(page, { min: 1 });
|
|
86
|
+
validateArray(accountIds);
|
|
87
|
+
|
|
88
|
+
if (fromDate) {
|
|
89
|
+
validateDateString(fromDate);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (toDate) {
|
|
93
|
+
validateDateString(toDate);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.page = page;
|
|
97
|
+
this.filters = { accountIds, fromDate, toDate };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
module.exports = {
|
|
102
|
+
AuditRequestModel,
|
|
103
|
+
AuditEntityModel,
|
|
104
|
+
AuditDatesModel,
|
|
105
|
+
AuditListParametersModel,
|
|
106
|
+
COI_AUDIT_STATUSES,
|
|
107
|
+
AUDIT_ENTITY_STATUSES,
|
|
108
|
+
AUDIT_ATTRIBUTE_NAMES,
|
|
109
|
+
AUDIT_POLICY_NAMES
|
|
110
|
+
};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
const DEFAULT_USER_ROLE = 'ICS';
|
|
2
|
-
|
|
3
|
-
const WAIVE_ACTIONS = {
|
|
4
|
-
WAIVE: 'ignored',
|
|
5
|
-
RETRACT: 'notIgnored'
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const WAIVER_REASONS = {
|
|
9
|
-
BUSINESS_DECISION: 'Business_Decision',
|
|
10
|
-
NO_EXPOSURE: 'No_Exposure',
|
|
11
|
-
EXECUTIVE_APPROVAL: 'Executive_Approval'
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
function WaiveRequestModel({
|
|
15
|
-
userId,
|
|
16
|
-
contractorId,
|
|
17
|
-
auditId,
|
|
18
|
-
waiverReason,
|
|
19
|
-
remarks = '',
|
|
20
|
-
userRole = DEFAULT_USER_ROLE
|
|
21
|
-
}) {
|
|
22
|
-
this.auditorContractorId = auditId;
|
|
23
|
-
this.contractorId = contractorId;
|
|
24
|
-
this.userId = userId;
|
|
25
|
-
this.waiverReason = waiverReason;
|
|
26
|
-
this.remarks = remarks;
|
|
27
|
-
|
|
28
|
-
this.userRole = userRole;
|
|
29
|
-
this.status = WAIVE_ACTIONS.WAIVE;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function RetractRequestModel({ userId, contractorId, auditId, userRole = DEFAULT_USER_ROLE }) {
|
|
33
|
-
this.auditorContractorId = auditId;
|
|
34
|
-
this.contractorId = contractorId;
|
|
35
|
-
this.userId = userId;
|
|
36
|
-
this.userRole = userRole;
|
|
37
|
-
this.status = WAIVE_ACTIONS.RETRACT;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = {
|
|
41
|
-
WaiveRequestModel,
|
|
42
|
-
RetractRequestModel,
|
|
43
|
-
WAIVE_ACTIONS,
|
|
44
|
-
WAIVER_REASONS
|
|
45
|
-
};
|
|
1
|
+
const DEFAULT_USER_ROLE = 'ICS';
|
|
2
|
+
|
|
3
|
+
const WAIVE_ACTIONS = {
|
|
4
|
+
WAIVE: 'ignored',
|
|
5
|
+
RETRACT: 'notIgnored'
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const WAIVER_REASONS = {
|
|
9
|
+
BUSINESS_DECISION: 'Business_Decision',
|
|
10
|
+
NO_EXPOSURE: 'No_Exposure',
|
|
11
|
+
EXECUTIVE_APPROVAL: 'Executive_Approval'
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function WaiveRequestModel({
|
|
15
|
+
userId,
|
|
16
|
+
contractorId,
|
|
17
|
+
auditId,
|
|
18
|
+
waiverReason,
|
|
19
|
+
remarks = '',
|
|
20
|
+
userRole = DEFAULT_USER_ROLE
|
|
21
|
+
}) {
|
|
22
|
+
this.auditorContractorId = auditId;
|
|
23
|
+
this.contractorId = contractorId;
|
|
24
|
+
this.userId = userId;
|
|
25
|
+
this.waiverReason = waiverReason;
|
|
26
|
+
this.remarks = remarks;
|
|
27
|
+
|
|
28
|
+
this.userRole = userRole;
|
|
29
|
+
this.status = WAIVE_ACTIONS.WAIVE;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function RetractRequestModel({ userId, contractorId, auditId, userRole = DEFAULT_USER_ROLE }) {
|
|
33
|
+
this.auditorContractorId = auditId;
|
|
34
|
+
this.contractorId = contractorId;
|
|
35
|
+
this.userId = userId;
|
|
36
|
+
this.userRole = userRole;
|
|
37
|
+
this.status = WAIVE_ACTIONS.RETRACT;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
WaiveRequestModel,
|
|
42
|
+
RetractRequestModel,
|
|
43
|
+
WAIVE_ACTIONS,
|
|
44
|
+
WAIVER_REASONS
|
|
45
|
+
};
|
|
@@ -1,165 +1,159 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
create: `${backendUrl}/saas/contractors/invite`,
|
|
6
|
-
get: `${backendUrl}/saas/contractors`,
|
|
7
|
-
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
8
|
-
getRecordHistory: contractorId => `${backendUrl}/saas/record/${contractorId}/history`,
|
|
9
|
-
delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
10
|
-
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
11
|
-
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
12
|
-
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
|
-
sendGaps: `${backendUrl}/saas/contractor/compliance/status`,
|
|
14
|
-
requestNewCoiAboutToExpire: `${backendUrl}/saas/coi/about-to-expire`,
|
|
15
|
-
requestNewCoiExpired: `${backendUrl}/saas/coi/expired`,
|
|
16
|
-
resendInvitation: contractorId => `${backendUrl}/saas/contractor/${contractorId}/reminders/reset`,
|
|
17
|
-
muteNotifications: `${backendUrl}/saas/record/notifications/mute`,
|
|
18
|
-
unmuteNotifications: `${backendUrl}/saas/record/notifications/unmute`,
|
|
19
|
-
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
20
|
-
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
21
|
-
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
22
|
-
assignMptToProperties: (accountId, tenantId) => `${backendUrl}/saas/account/${accountId}/multi-properties/${tenantId}`,
|
|
23
|
-
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
24
|
-
`${backendUrl}/saas/contractors/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
return requests.
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
requestNewCoiAboutToExpire,
|
|
161
|
-
requestNewCoiExpired,
|
|
162
|
-
resendInvitation,
|
|
163
|
-
muteNotifications,
|
|
164
|
-
unmuteNotifications
|
|
165
|
-
};
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
create: `${backendUrl}/saas/contractors/invite`,
|
|
6
|
+
get: `${backendUrl}/saas/contractors`,
|
|
7
|
+
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
8
|
+
getRecordHistory: contractorId => `${backendUrl}/saas/record/${contractorId}/history`,
|
|
9
|
+
delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
10
|
+
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
11
|
+
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
12
|
+
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
|
+
sendGaps: `${backendUrl}/saas/contractor/compliance/status`,
|
|
14
|
+
requestNewCoiAboutToExpire: `${backendUrl}/saas/coi/about-to-expire`,
|
|
15
|
+
requestNewCoiExpired: `${backendUrl}/saas/coi/expired`,
|
|
16
|
+
resendInvitation: contractorId => `${backendUrl}/saas/contractor/${contractorId}/reminders/reset`,
|
|
17
|
+
muteNotifications: `${backendUrl}/saas/record/notifications/mute`,
|
|
18
|
+
unmuteNotifications: `${backendUrl}/saas/record/notifications/unmute`,
|
|
19
|
+
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
20
|
+
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
21
|
+
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
22
|
+
assignMptToProperties: (accountId, tenantId) => `${backendUrl}/saas/account/${accountId}/multi-properties/${tenantId}`,
|
|
23
|
+
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
24
|
+
`${backendUrl}/saas/contractors/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
25
|
+
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
26
|
+
publicLinkInvite: `${backendUrl}/_saas/contractors/publicinvite`
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const createContractor = (createContractorModel, context) => {
|
|
30
|
+
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const getContractorsByAccountId = (params, context) => {
|
|
34
|
+
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getContractorById = (contractorId, context) => {
|
|
38
|
+
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getRecordHistory = (contractorId, context) => {
|
|
42
|
+
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const deleteByContractorId = (contractorId, context) => {
|
|
46
|
+
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const archiveByContractorId = (contractorId, context) => {
|
|
50
|
+
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const restoreContractor = (recordVerificationModel, context) => {
|
|
54
|
+
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const editContractor = (editRequestModel, context) => {
|
|
58
|
+
const params = { updateInfoUser: 'EditVendor' };
|
|
59
|
+
const { record: { contractorId } } = editRequestModel;
|
|
60
|
+
return requests.postRequestHandler(Endpoints.edit(contractorId), editRequestModel, context, {}, params);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
64
|
+
return requests.postRequestHandler(Endpoints.muteNotifications, recordModifyDateVerificationModel, context);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const unmuteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
68
|
+
return requests.postRequestHandler(Endpoints.unmuteNotifications, recordModifyDateVerificationModel, context);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
72
|
+
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
76
|
+
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
80
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
84
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
88
|
+
return requests.postRequestHandler(Endpoints.resendInvitation, recordModifyDateVerificationModel, context);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
92
|
+
const data = { [policyName]: expiryDate };
|
|
93
|
+
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
97
|
+
const data = { date: inviteDate };
|
|
98
|
+
return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const assignMptToProperties = (assignToMptModel, context) => {
|
|
102
|
+
const params = { updateInfoUser: 'EditVendor' };
|
|
103
|
+
return requests.postRequestHandler(
|
|
104
|
+
Endpoints.assignMptToProperties(assignToMptModel.accountId, assignToMptModel.tenantId),
|
|
105
|
+
assignToMptModel.properties,
|
|
106
|
+
context,
|
|
107
|
+
{},
|
|
108
|
+
params
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const getContractorsByTabId = async (tabId, context, activityStatus) => {
|
|
113
|
+
const body = { tabId, activityStatus };
|
|
114
|
+
const response = await requests.postRequestHandler(Endpoints.get, body, context);
|
|
115
|
+
const records = {
|
|
116
|
+
... response,
|
|
117
|
+
data: response.data.map(({ record }) => record)
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return records;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const searchInAutocomplete = ({ tabId, searchWord }, context) => {
|
|
124
|
+
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
128
|
+
const url = `${Endpoints.automationUpdateContractorUploadDate(contractorId) }?uploadDate=${uploadDate.toISOString()}`;
|
|
129
|
+
return requests.patchRequestHandler(url, context);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const inviteContractorViaPublicLink = (createContractorModel, context) => {
|
|
133
|
+
return requests.postRequestHandler(Endpoints.publicLinkInvite, createContractorModel, context);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
module.exports = {
|
|
137
|
+
createContractor,
|
|
138
|
+
changeRequirement,
|
|
139
|
+
getContractorsByAccountId,
|
|
140
|
+
getContractorById,
|
|
141
|
+
getRecordHistory,
|
|
142
|
+
deleteByContractorId,
|
|
143
|
+
archiveByContractorId,
|
|
144
|
+
restoreContractor,
|
|
145
|
+
editContractor,
|
|
146
|
+
updateInviteDate,
|
|
147
|
+
updateExpiryDate,
|
|
148
|
+
assignMptToProperties,
|
|
149
|
+
getContractorsByTabId,
|
|
150
|
+
searchInAutocomplete,
|
|
151
|
+
updateContractorUploadDate,
|
|
152
|
+
inviteContractorViaPublicLink,
|
|
153
|
+
sendGaps,
|
|
154
|
+
requestNewCoiAboutToExpire,
|
|
155
|
+
requestNewCoiExpired,
|
|
156
|
+
resendInvitation,
|
|
157
|
+
muteNotifications,
|
|
158
|
+
unmuteNotifications
|
|
159
|
+
};
|