@getjones/test-infra 2.9.0 → 2.9.1
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/commonFlows/records/records.js +8 -8
- package/src/common/utils/complianceUtil.js +7 -8
- package/src/common/utils/timeUtils.js +18 -0
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +13 -7
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +10 -6
- package/src/saas/internal-api/contractors/api/contractors.api.js +2 -2
- package/src/saas/internal-api/contractors/api/contractors.service.js +2 -3
package/package.json
CHANGED
|
@@ -7,12 +7,12 @@ const contractors = require('../../../saas/internal-api/contractors');
|
|
|
7
7
|
const compliance = require('../../../saas/internal-api/compliance');
|
|
8
8
|
|
|
9
9
|
const makeRecordNotResponsive = async function(recordId, context, { isTenant } = {}) {
|
|
10
|
-
const
|
|
11
|
-
timeUtils.
|
|
12
|
-
timeUtils.
|
|
10
|
+
const datesOffset = isTenant ?
|
|
11
|
+
timeUtils.getInviteActionDatesOffsetForNotResponsiveTenant() :
|
|
12
|
+
timeUtils.getInviteActionDatesOffsetForNotResponsiveVendor();
|
|
13
13
|
|
|
14
|
-
for (const
|
|
15
|
-
await updateLastInviteActionDate(recordId,
|
|
14
|
+
for (const dateOffset of datesOffset) {
|
|
15
|
+
await updateLastInviteActionDate(recordId, dateOffset, context);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -33,20 +33,20 @@ const updateInviteDate = async function(recordId, inviteDate, context) {
|
|
|
33
33
|
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const updateLastInviteActionDate = async function(recordId,
|
|
36
|
+
const updateLastInviteActionDate = async function(recordId, dateOffset, context) {
|
|
37
37
|
await timeUtils.waitFor(1).seconds;
|
|
38
38
|
/*
|
|
39
39
|
To run the reminders mails successfully we must first update the compliance audit actions date,
|
|
40
40
|
Since the thread scheduler will trigger the logic of the reminders mails
|
|
41
41
|
only if last invite action date will be equal or after compliance audit actions date
|
|
42
42
|
*/
|
|
43
|
-
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId,
|
|
43
|
+
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
44
44
|
|
|
45
45
|
if (updateComplianceAuditResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
46
46
|
throw new Error(`Compliance audit date could not be updated\n${updateComplianceAuditResponse}`);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId,
|
|
49
|
+
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId, dateOffset, context);
|
|
50
50
|
|
|
51
51
|
if (updateLastInviteActionResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
52
52
|
throw new Error(`Record invite date could not be updated\n${updateLastInviteActionResponse}`);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
const { getEnv, getSystemUserIdentity } = require('../../env');
|
|
2
|
+
const auditApi = require('../../saas/internal-api/compliance/api/audit/audit.api');
|
|
2
3
|
const auditConfigs = require('../../defaults/configs/auditConfigs');
|
|
3
4
|
|
|
4
5
|
const { credentials } = getEnv();
|
|
5
6
|
|
|
6
|
-
const auditApi = require('../../saas/internal-api/compliance/api/audit/audit.api');
|
|
7
|
-
|
|
8
7
|
const complianceStatuses = {
|
|
9
8
|
complaint: 'complaint',
|
|
10
9
|
notCompliant: 'notCompliant',
|
|
@@ -44,16 +43,16 @@ const getAuditMetadata = async (
|
|
|
44
43
|
const isReauditResponse = await isReaudit(recordId, auditorContext);
|
|
45
44
|
metadata.isReaudit = isReauditResponse.data.isReaudit;
|
|
46
45
|
|
|
47
|
-
const recordDetailsResponse = await auditApi.
|
|
48
|
-
const
|
|
46
|
+
const recordDetailsResponse = await auditApi.getAuditRecordModel(recordId, auditorContext);
|
|
47
|
+
const recordDetails = recordDetailsResponse.data;
|
|
49
48
|
|
|
50
|
-
metadata.certificateId =
|
|
49
|
+
metadata.certificateId = recordDetails.certificateDetails.certificateuploadId;
|
|
51
50
|
metadata.auditDates = {
|
|
52
51
|
contractorId: recordId,
|
|
53
|
-
contractorDateModified:
|
|
52
|
+
contractorDateModified: recordDetails.dateModified,
|
|
54
53
|
dateStartedAudit: recordDetailsResponse.dateStartedAudit,
|
|
55
|
-
contractorOverrideDateModified:
|
|
56
|
-
contractCreateDate:
|
|
54
|
+
contractorOverrideDateModified: recordDetails.contractorOverrideDateModified,
|
|
55
|
+
contractCreateDate: recordDetails.contractCreateDate
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
metadata.auditorId = await getAuditorId();
|
|
@@ -24,6 +24,14 @@ const peroids = {
|
|
|
24
24
|
years: 'years'
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const inviteActionDateOffset = {
|
|
28
|
+
twoDays: 2,
|
|
29
|
+
fiveDays: 5,
|
|
30
|
+
eightDays: 8,
|
|
31
|
+
tenDays: 10,
|
|
32
|
+
fifteenDays: 15
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
const getOneYearAgoDate = format => moment().utc().subtract(1, peroids.years).format(format || formats.threadScheduler);
|
|
28
36
|
const getTwoHundredDaysAgoDate = format => moment().utc().subtract(200, peroids.days).format(format || formats.threadScheduler);
|
|
29
37
|
const getSixMonthAgoDate = format => moment().utc().subtract(6, peroids.months).format(format || formats.threadScheduler);
|
|
@@ -86,6 +94,10 @@ const getInvitationDatesForNotResponsiveVendor = function() {
|
|
|
86
94
|
return [twoDaysAgoUtc, fiveDaysAgoUtc, eightDaysAgoUtc];
|
|
87
95
|
};
|
|
88
96
|
|
|
97
|
+
const getInviteActionDatesOffsetForNotResponsiveVendor = function() {
|
|
98
|
+
return [inviteActionDateOffset.twoDays, inviteActionDateOffset.fiveDays, inviteActionDateOffset.eightDays];
|
|
99
|
+
};
|
|
100
|
+
|
|
89
101
|
const getInvitationDatesForNotResponsiveTenant = function() {
|
|
90
102
|
const fiveDaysAgoUtc = getFiveDaysAgoDate();
|
|
91
103
|
const tenDaysAgoUtc = getTenDaysAgoDate();
|
|
@@ -94,6 +106,10 @@ const getInvitationDatesForNotResponsiveTenant = function() {
|
|
|
94
106
|
return [fiveDaysAgoUtc, tenDaysAgoUtc, fifteenDaysAgoUtc];
|
|
95
107
|
};
|
|
96
108
|
|
|
109
|
+
const getInviteActionDatesOffsetForNotResponsiveTenant = function() {
|
|
110
|
+
return [inviteActionDateOffset.fiveDays, inviteActionDateOffset.tenDays, inviteActionDateOffset.fifteenDays];
|
|
111
|
+
};
|
|
112
|
+
|
|
97
113
|
const isDateAfterOther = (date, other) => {
|
|
98
114
|
return moment(date).isAfter(other);
|
|
99
115
|
};
|
|
@@ -140,7 +156,9 @@ module.exports = {
|
|
|
140
156
|
getDateinTwentyNineDays,
|
|
141
157
|
getDateInTwoMonths,
|
|
142
158
|
getInvitationDatesForNotResponsiveVendor,
|
|
159
|
+
getInviteActionDatesOffsetForNotResponsiveVendor,
|
|
143
160
|
getInvitationDatesForNotResponsiveTenant,
|
|
161
|
+
getInviteActionDatesOffsetForNotResponsiveTenant,
|
|
144
162
|
getAutomaticRenewalsExpirationDates,
|
|
145
163
|
getLogTimestamp,
|
|
146
164
|
getDayInMilliseconds,
|
|
@@ -6,7 +6,8 @@ const { convertDateStringFormatToISOString } = require('../../../../../common/ut
|
|
|
6
6
|
const Endpoints = {
|
|
7
7
|
auditorContractorList: `${backendUrl}/saas/auditor/contractors`,
|
|
8
8
|
audit: `${backendUrl}/saas/auditor/contractors/submit/audits`,
|
|
9
|
-
|
|
9
|
+
enterAudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/master-audit`,
|
|
10
|
+
getAuditRecordModelByRecordId: recordId => `${backendUrl}/saas/auditor/record/${recordId}/audit-record`,
|
|
10
11
|
requirementDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractor/${contractorId}/requirement`,
|
|
11
12
|
isReaudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/isreaudit`,
|
|
12
13
|
revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert`,
|
|
@@ -16,7 +17,7 @@ const Endpoints = {
|
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const audit = async (contractorId, auditRequestModel, context) => {
|
|
19
|
-
await
|
|
20
|
+
await enterAudit(contractorId, {}, context);
|
|
20
21
|
return submitAudit(auditRequestModel, context);
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -36,8 +37,12 @@ const getAuditorContractorList = (auditListParametersModel, context) => {
|
|
|
36
37
|
return requests.postRequestHandler(Endpoints.auditorContractorList, auditListParametersModel, context);
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
const
|
|
40
|
-
return requests.getRequestHandler(Endpoints.
|
|
40
|
+
const enterAudit = (contractorId, context) => {
|
|
41
|
+
return requests.getRequestHandler(Endpoints.enterAudit(contractorId), {}, context);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getAuditRecordModel = (recordId, context) => {
|
|
45
|
+
return requests.getRequestHandler(Endpoints.getAuditRecordModelByRecordId(recordId), {}, context);
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
const getRequirementDetailsForAudit = (contractorId, context) => {
|
|
@@ -53,8 +58,8 @@ const wrongCoi = (recordId, context) => {
|
|
|
53
58
|
return requests.getRequestHandler(Endpoints.wrongCoi, params, context);
|
|
54
59
|
};
|
|
55
60
|
|
|
56
|
-
const updateComplianceAuditActionsDate = (recordId,
|
|
57
|
-
const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?
|
|
61
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
62
|
+
const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?complianceAuditActionsDateOffset=${dateOffset}`;
|
|
58
63
|
return requests.putRequestHandler(url, {}, context);
|
|
59
64
|
};
|
|
60
65
|
|
|
@@ -65,7 +70,8 @@ module.exports = {
|
|
|
65
70
|
wrongCoi,
|
|
66
71
|
isReaudit,
|
|
67
72
|
getAuditorContractorList,
|
|
68
|
-
|
|
73
|
+
enterAudit,
|
|
74
|
+
getAuditRecordModel,
|
|
69
75
|
getRequirementDetailsForAudit,
|
|
70
76
|
getAuditByRecordId,
|
|
71
77
|
updateComplianceAuditActionsDate
|
|
@@ -34,8 +34,12 @@ const getAuditorContractorList = (auditListParametersModel, context) => {
|
|
|
34
34
|
return auditApi.getAuditorContractorList(auditListParametersModel, context);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const
|
|
38
|
-
return auditApi.
|
|
37
|
+
const enterAudit = (contractorId, context) => {
|
|
38
|
+
return auditApi.enterAudit(contractorId, context);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getAuditRecordModel = (recordId, context) => {
|
|
42
|
+
return auditApi.getAuditRecordModel(recordId, context);
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
const getRequirementDetailsForAudit = (contractorId, context) => {
|
|
@@ -144,9 +148,8 @@ const auditRecord = async function(
|
|
|
144
148
|
return auditResponse;
|
|
145
149
|
};
|
|
146
150
|
|
|
147
|
-
const updateComplianceAuditActionsDate = (recordId,
|
|
148
|
-
|
|
149
|
-
return auditApi.updateComplianceAuditActionsDate(recordId, customLastInviteActionDate, context);
|
|
151
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
152
|
+
return auditApi.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
150
153
|
};
|
|
151
154
|
|
|
152
155
|
module.exports = {
|
|
@@ -156,8 +159,9 @@ module.exports = {
|
|
|
156
159
|
isReaudit,
|
|
157
160
|
wrongCoi,
|
|
158
161
|
getAuditorContractorList,
|
|
159
|
-
|
|
162
|
+
enterAudit,
|
|
160
163
|
getRequirementDetailsForAudit,
|
|
164
|
+
getAuditRecordModel,
|
|
161
165
|
getAuditEntities,
|
|
162
166
|
getAuditMetadata,
|
|
163
167
|
getAuditByRecordId,
|
|
@@ -128,8 +128,8 @@ const getLinkedProjectsCount = async (recordId, context) => {
|
|
|
128
128
|
return await requests.getRequestHandler(Endpoints.linkedProjectsCount(recordId), {}, context);
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
const updateLastInviteActionDate = (recordId,
|
|
132
|
-
const url = `${Endpoints.updateLastInviteActionDate(recordId)}?
|
|
131
|
+
const updateLastInviteActionDate = (recordId, dateOffset, context) => {
|
|
132
|
+
const url = `${Endpoints.updateLastInviteActionDate(recordId)}?actionDateOffset=${dateOffset}`;
|
|
133
133
|
return requests.putRequestHandler(url, {}, context);
|
|
134
134
|
};
|
|
135
135
|
|
|
@@ -54,9 +54,8 @@ const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
|
54
54
|
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
const updateLastInviteActionDate = (recordId,
|
|
58
|
-
|
|
59
|
-
return contractorsAPI.updateLastInviteActionDate(recordId, customLastInviteActionDate, context);
|
|
57
|
+
const updateLastInviteActionDate = (recordId, dateOffset, context) => {
|
|
58
|
+
return contractorsAPI.updateLastInviteActionDate(recordId, dateOffset, context);
|
|
60
59
|
};
|
|
61
60
|
|
|
62
61
|
const getContractorsByTabId = (tabId, context, activityStatus = 'Active') => {
|