@getjones/test-infra 2.8.15 → 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 +36 -6
- package/src/common/utils/timeUtils.js +24 -1
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +11 -2
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +7 -2
- package/src/saas/internal-api/compliance/consts/audit.js +1 -20
- package/src/saas/internal-api/contractors/api/contractors.api.js +9 -1
- package/src/saas/internal-api/contractors/api/contractors.service.js +7 -2
- package/src/resources/virusFile.pdf +0 -0
package/package.json
CHANGED
|
@@ -4,14 +4,15 @@ const threadScheduler = require('../../../saas/internal-api/thread-scheduler/run
|
|
|
4
4
|
const timeUtils = require('../../utils/timeUtils');
|
|
5
5
|
const httpResponseStatusCodes = require('../../../common/httpResponseStatusCodes.json');
|
|
6
6
|
const contractors = require('../../../saas/internal-api/contractors');
|
|
7
|
+
const compliance = require('../../../saas/internal-api/compliance');
|
|
7
8
|
|
|
8
9
|
const makeRecordNotResponsive = async function(recordId, context, { isTenant } = {}) {
|
|
9
|
-
const
|
|
10
|
-
timeUtils.
|
|
11
|
-
timeUtils.
|
|
10
|
+
const datesOffset = isTenant ?
|
|
11
|
+
timeUtils.getInviteActionDatesOffsetForNotResponsiveTenant() :
|
|
12
|
+
timeUtils.getInviteActionDatesOffsetForNotResponsiveVendor();
|
|
12
13
|
|
|
13
|
-
for (const
|
|
14
|
-
await
|
|
14
|
+
for (const dateOffset of datesOffset) {
|
|
15
|
+
await updateLastInviteActionDate(recordId, dateOffset, context);
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
|
|
@@ -32,6 +33,34 @@ const updateInviteDate = async function(recordId, inviteDate, context) {
|
|
|
32
33
|
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
const updateLastInviteActionDate = async function(recordId, dateOffset, context) {
|
|
37
|
+
await timeUtils.waitFor(1).seconds;
|
|
38
|
+
/*
|
|
39
|
+
To run the reminders mails successfully we must first update the compliance audit actions date,
|
|
40
|
+
Since the thread scheduler will trigger the logic of the reminders mails
|
|
41
|
+
only if last invite action date will be equal or after compliance audit actions date
|
|
42
|
+
*/
|
|
43
|
+
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
44
|
+
|
|
45
|
+
if (updateComplianceAuditResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
46
|
+
throw new Error(`Compliance audit date could not be updated\n${updateComplianceAuditResponse}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId, dateOffset, context);
|
|
50
|
+
|
|
51
|
+
if (updateLastInviteActionResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
52
|
+
throw new Error(`Record invite date could not be updated\n${updateLastInviteActionResponse}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
56
|
+
|
|
57
|
+
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
58
|
+
throw new Error(`Thread scheduler has failed to run\n${threadSchedulerResponse}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
62
|
+
};
|
|
63
|
+
|
|
35
64
|
const runOverAllRenewalDatesForRecord = async function(recordId, policyName) {
|
|
36
65
|
const dates = timeUtils.getAutomaticRenewalsExpirationDates();
|
|
37
66
|
|
|
@@ -68,5 +97,6 @@ module.exports = {
|
|
|
68
97
|
runOverAllRenewalDatesForRecord,
|
|
69
98
|
updateInviteDate,
|
|
70
99
|
updatePolicyExpiryDateForRecord,
|
|
71
|
-
getHistoryEvents
|
|
100
|
+
getHistoryEvents,
|
|
101
|
+
updateLastInviteActionDate
|
|
72
102
|
};
|
|
@@ -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
|
};
|
|
@@ -115,6 +131,10 @@ const convertDateToLongInt = value => {
|
|
|
115
131
|
return Date.parse(value);
|
|
116
132
|
};
|
|
117
133
|
|
|
134
|
+
const convertDateStringFormatToISOString = dateStringFormat => {
|
|
135
|
+
return new Date(dateStringFormat).toISOString();
|
|
136
|
+
};
|
|
137
|
+
|
|
118
138
|
module.exports = {
|
|
119
139
|
formats,
|
|
120
140
|
getOneYearAgoDate,
|
|
@@ -136,7 +156,9 @@ module.exports = {
|
|
|
136
156
|
getDateinTwentyNineDays,
|
|
137
157
|
getDateInTwoMonths,
|
|
138
158
|
getInvitationDatesForNotResponsiveVendor,
|
|
159
|
+
getInviteActionDatesOffsetForNotResponsiveVendor,
|
|
139
160
|
getInvitationDatesForNotResponsiveTenant,
|
|
161
|
+
getInviteActionDatesOffsetForNotResponsiveTenant,
|
|
140
162
|
getAutomaticRenewalsExpirationDates,
|
|
141
163
|
getLogTimestamp,
|
|
142
164
|
getDayInMilliseconds,
|
|
@@ -147,5 +169,6 @@ module.exports = {
|
|
|
147
169
|
convertDateToNewFormat,
|
|
148
170
|
getOneWeekAgoDate,
|
|
149
171
|
getOneWeekAheadDate,
|
|
150
|
-
convertDateToLongInt
|
|
172
|
+
convertDateToLongInt,
|
|
173
|
+
convertDateStringFormatToISOString
|
|
151
174
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
2
2
|
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
3
|
|
|
4
|
+
const { convertDateStringFormatToISOString } = require('../../../../../common/utils/timeUtils');
|
|
5
|
+
|
|
4
6
|
const Endpoints = {
|
|
5
7
|
auditorContractorList: `${backendUrl}/saas/auditor/contractors`,
|
|
6
8
|
audit: `${backendUrl}/saas/auditor/contractors/submit/audits`,
|
|
@@ -10,7 +12,8 @@ const Endpoints = {
|
|
|
10
12
|
isReaudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/isreaudit`,
|
|
11
13
|
revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert`,
|
|
12
14
|
wrongCoi: `${backendUrl}/saas/coi/wrong-coi`,
|
|
13
|
-
getAudit: recordId => `${backendUrl}/saas/audit/${recordId}
|
|
15
|
+
getAudit: recordId => `${backendUrl}/saas/audit/${recordId}`,
|
|
16
|
+
updateComplianceAuditActionsDate: recordId => `${backendUrl}/saas/automation/audit/record/${recordId}/compliance-audit-actions/date`
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
const audit = async (contractorId, auditRequestModel, context) => {
|
|
@@ -55,6 +58,11 @@ const wrongCoi = (recordId, context) => {
|
|
|
55
58
|
return requests.getRequestHandler(Endpoints.wrongCoi, params, context);
|
|
56
59
|
};
|
|
57
60
|
|
|
61
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
62
|
+
const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?complianceAuditActionsDateOffset=${dateOffset}`;
|
|
63
|
+
return requests.putRequestHandler(url, {}, context);
|
|
64
|
+
};
|
|
65
|
+
|
|
58
66
|
module.exports = {
|
|
59
67
|
audit,
|
|
60
68
|
submitAudit,
|
|
@@ -65,5 +73,6 @@ module.exports = {
|
|
|
65
73
|
enterAudit,
|
|
66
74
|
getAuditRecordModel,
|
|
67
75
|
getRequirementDetailsForAudit,
|
|
68
|
-
getAuditByRecordId
|
|
76
|
+
getAuditByRecordId,
|
|
77
|
+
updateComplianceAuditActionsDate
|
|
69
78
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const auditApi = require('./audit.api');
|
|
2
2
|
const { AuditRequestModel, AuditListParametersModel, AuditDatesModel } = require('../../models/audit/audit.model');
|
|
3
|
-
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
3
|
+
const { validateType, validateDateString } = require('../../../../../common/validations/typeValidations');
|
|
4
4
|
const auditUtil = require('../../utils/auditUtil');
|
|
5
5
|
const dataTypeUtils = require('../../../../../common/utils/dataTypeUtils');
|
|
6
6
|
const { cloneObject } = require('../../../../../common/utils/objectUtils');
|
|
@@ -148,6 +148,10 @@ const auditRecord = async function(
|
|
|
148
148
|
return auditResponse;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
152
|
+
return auditApi.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
153
|
+
};
|
|
154
|
+
|
|
151
155
|
module.exports = {
|
|
152
156
|
audit,
|
|
153
157
|
submitAudit,
|
|
@@ -162,5 +166,6 @@ module.exports = {
|
|
|
162
166
|
getAuditMetadata,
|
|
163
167
|
getAuditByRecordId,
|
|
164
168
|
getAuditRequestModel,
|
|
165
|
-
auditRecord
|
|
169
|
+
auditRecord,
|
|
170
|
+
updateComplianceAuditActionsDate
|
|
166
171
|
};
|
|
@@ -60,23 +60,6 @@ const ATTRIBUTE_NAMES_MAP = {
|
|
|
60
60
|
signature: 'signature'
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const auditTriggerType = {
|
|
64
|
-
newAudit: 'NEW_AUDIT',
|
|
65
|
-
changeRequirements: 'CHANGE_REQUIREMENTS',
|
|
66
|
-
updateRequirements: 'UPDATE_REQUIREMENTS',
|
|
67
|
-
updateRequirementsWithNotifications: 'ENTITY_CHANGED',
|
|
68
|
-
gaps: 'GAPS',
|
|
69
|
-
renewal: 'RENEWAL'
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const auditStatus = {
|
|
73
|
-
pending: 'PENDING',
|
|
74
|
-
inProgress: 'IN_PROGRESS',
|
|
75
|
-
onHold: 'ON_HOLD',
|
|
76
|
-
done: 'DONE',
|
|
77
|
-
canceled: 'CANCELED'
|
|
78
|
-
};
|
|
79
|
-
|
|
80
63
|
module.exports = {
|
|
81
64
|
DEFAULT_POLICY_ID,
|
|
82
65
|
POLICY_NAMES_MAP,
|
|
@@ -84,7 +67,5 @@ module.exports = {
|
|
|
84
67
|
COI_AUDIT_STATUSES,
|
|
85
68
|
AUDITOR_ROLE,
|
|
86
69
|
AUDIT_ENTITY_STATUSES,
|
|
87
|
-
VALID_SCORES
|
|
88
|
-
auditTriggerType,
|
|
89
|
-
auditStatus
|
|
70
|
+
VALID_SCORES
|
|
90
71
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
2
|
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
const { convertDateStringFormatToISOString } = require('../../../../common/utils/timeUtils');
|
|
3
4
|
|
|
4
5
|
const Endpoints = {
|
|
5
6
|
create: `${backendUrl}/saas/contractors/invite`,
|
|
@@ -19,6 +20,7 @@ const Endpoints = {
|
|
|
19
20
|
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
20
21
|
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
21
22
|
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
23
|
+
updateLastInviteActionDate: recordId => `${backendUrl}/saas/automation/invite/record/${recordId}/last-invite-action/date`,
|
|
22
24
|
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
23
25
|
`${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
24
26
|
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
@@ -126,6 +128,11 @@ const getLinkedProjectsCount = async (recordId, context) => {
|
|
|
126
128
|
return await requests.getRequestHandler(Endpoints.linkedProjectsCount(recordId), {}, context);
|
|
127
129
|
};
|
|
128
130
|
|
|
131
|
+
const updateLastInviteActionDate = (recordId, dateOffset, context) => {
|
|
132
|
+
const url = `${Endpoints.updateLastInviteActionDate(recordId)}?actionDateOffset=${dateOffset}`;
|
|
133
|
+
return requests.putRequestHandler(url, {}, context);
|
|
134
|
+
};
|
|
135
|
+
|
|
129
136
|
module.exports = {
|
|
130
137
|
createContractor,
|
|
131
138
|
changeRequirement,
|
|
@@ -148,5 +155,6 @@ module.exports = {
|
|
|
148
155
|
resendInvitation,
|
|
149
156
|
muteNotifications,
|
|
150
157
|
unmuteNotifications,
|
|
151
|
-
getLinkedProjectsCount
|
|
158
|
+
getLinkedProjectsCount,
|
|
159
|
+
updateLastInviteActionDate
|
|
152
160
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const contractorsAPI = require('./contractors.api');
|
|
2
2
|
const { CreateContractorModel } = require('../models/create.contractor.model');
|
|
3
3
|
const { RequestModel } = require('../../requests/models/edit.request.model');
|
|
4
|
-
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
4
|
+
const { validateType, validateDateString } = require('../../../../common/validations/typeValidations');
|
|
5
5
|
const { RecordModifyDateVerificationModel } = require('../models/verification.contractor.model');
|
|
6
6
|
const { AssignRequirementModel } = require('../models/assign.requirement.model');
|
|
7
7
|
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
@@ -54,6 +54,10 @@ const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
|
54
54
|
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
const updateLastInviteActionDate = (recordId, dateOffset, context) => {
|
|
58
|
+
return contractorsAPI.updateLastInviteActionDate(recordId, dateOffset, context);
|
|
59
|
+
};
|
|
60
|
+
|
|
57
61
|
const getContractorsByTabId = (tabId, context, activityStatus = 'Active') => {
|
|
58
62
|
return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
|
|
59
63
|
};
|
|
@@ -184,5 +188,6 @@ module.exports = {
|
|
|
184
188
|
assignRequirement,
|
|
185
189
|
getAssignRequirementModel,
|
|
186
190
|
getLinkedProjectsCount,
|
|
187
|
-
restoreByRecordId
|
|
191
|
+
restoreByRecordId,
|
|
192
|
+
updateLastInviteActionDate
|
|
188
193
|
};
|
|
Binary file
|