@getjones/test-infra 2.8.6 → 2.8.8
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/consts/dashboardCharts.js +2 -1
- package/src/common/consts/userTypes.js +2 -1
- package/src/factory/records/records.js +2 -1
- package/src/saas/internal-api/agreement/index.js +1 -1
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +2 -2
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +8 -1
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +10 -3
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +20 -2
- package/src/saas/internal-api/contractors/api/contractors.api.js +5 -5
- package/src/saas/internal-api/contractors/api/contractors.service.js +18 -6
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +9 -7
- package/src/saas/internal-api/dbEmails/consts/consts.js +5 -1
- package/src/saas/internal-api/dbEmails/index.js +2 -1
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +2 -1
- package/src/saas/internal-api/dbEmails/utils/util.js +6 -3
- package/src/saas/internal-api/users/api/users.api.js +9 -2
- package/src/saas/internal-api/users/api/users.service.js +8 -1
- package/src/saas/internal-api/users/index.js +4 -1
- package/src/saas/internal-api/users/models/notification.settings.model.js +12 -0
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const chartTypes = {
|
|
2
2
|
requiringAttention: 'requiringAttention',
|
|
3
3
|
expirationDatePerMonth: 'expirationDatePerMonth',
|
|
4
|
-
waivedByRequirement: 'waivedByRequirement'
|
|
4
|
+
waivedByRequirement: 'waivedByRequirement',
|
|
5
|
+
notCompliantForRequirement: 'notCompliantForRequirement'
|
|
5
6
|
};
|
|
6
7
|
const sortBy = {
|
|
7
8
|
companyName: 'SORT_BY_COMPANYNAME',
|
|
@@ -121,8 +121,9 @@ const prepareWaivedRecord = async (recordCompany, recordEmail, tabId, requiremen
|
|
|
121
121
|
const prepareAwaitingNewCoiRecord = async (recordCompany, recordEmail, tabId, requirementId, context) => {
|
|
122
122
|
const recordId = await prepareRecord(recordCompany, recordEmail, complianceStatuses.awaitingNewCoi, tabId, requirementId, context);
|
|
123
123
|
|
|
124
|
+
const { id: requestId } = await requests.services.getRequestFromTabByRecordId(recordId, tabId, context);
|
|
124
125
|
const recordVerificationModel = await contractors.services.getRecordVerificationModel(recordId, context);
|
|
125
|
-
const sendGapsResponse = await contractors.services.sendGaps(recordVerificationModel, context);
|
|
126
|
+
const sendGapsResponse = await contractors.services.sendGaps(requestId, recordVerificationModel, context);
|
|
126
127
|
|
|
127
128
|
if (sendGapsResponse.status !== httpResponseStatusCodes.OK) {
|
|
128
129
|
throw Error(`Failed to send gaps to ${recordCompany}\n${sendGapsResponse}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { ICS, PM, AUDITOR } = require('../../../../common/consts/userTypes');
|
|
1
|
+
const { ICS, PM, AUDITOR, VENDOR } = require('../../../../common/consts/userTypes');
|
|
2
2
|
|
|
3
|
-
const UPLOADER_TYPES = { ICS, PM, AUDITOR };
|
|
3
|
+
const UPLOADER_TYPES = { ICS, PM, AUDITOR, VENDOR };
|
|
4
4
|
|
|
5
5
|
module.exports = UPLOADER_TYPES;
|
|
@@ -8,7 +8,8 @@ const Endpoints = {
|
|
|
8
8
|
contractorDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/master-audit`,
|
|
9
9
|
requirementDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractor/${contractorId}/requirement`,
|
|
10
10
|
isReaudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/isreaudit`,
|
|
11
|
-
revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert
|
|
11
|
+
revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert`,
|
|
12
|
+
wrongCoi: `${backendUrl}/saas/coi/wrong-coi`
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
const audit = async (contractorId, auditRequestModel, context) => {
|
|
@@ -36,9 +37,15 @@ const getRequirementDetailsForAudit = (contractorId, context) => {
|
|
|
36
37
|
return requests.getRequestHandler(Endpoints.requirementDetailsForAudit(contractorId), {}, context);
|
|
37
38
|
};
|
|
38
39
|
|
|
40
|
+
const wrongCoi = (recordId, context) => {
|
|
41
|
+
const params = { contractorId: recordId };
|
|
42
|
+
return requests.getRequestHandler(Endpoints.wrongCoi, params, context);
|
|
43
|
+
};
|
|
44
|
+
|
|
39
45
|
module.exports = {
|
|
40
46
|
audit,
|
|
41
47
|
revertCoi,
|
|
48
|
+
wrongCoi,
|
|
42
49
|
isReaudit,
|
|
43
50
|
getAuditorContractorList,
|
|
44
51
|
getContractorDetailsForAudit,
|
|
@@ -12,7 +12,12 @@ const audit = (auditRequestModel, context) => {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const revertCoi = (contractorId, dateModified, context) => {
|
|
15
|
-
|
|
15
|
+
const dateModifiedObj = { dateModified };
|
|
16
|
+
return auditApi.revertCoi(contractorId, dateModifiedObj, context);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const wrongCoi = (recordId, context) => {
|
|
20
|
+
return auditApi.wrongCoi(recordId, context);
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
const isReaudit = (contractorId, context) => {
|
|
@@ -114,9 +119,10 @@ const auditRecord = async function(
|
|
|
114
119
|
projectId,
|
|
115
120
|
requirementId,
|
|
116
121
|
recordId,
|
|
117
|
-
auditConfig
|
|
122
|
+
auditConfig,
|
|
123
|
+
{ shouldSendNotificationToPM = false } = {}
|
|
118
124
|
) {
|
|
119
|
-
const auditMetadata = await getAuditMetadata(auditorContext, accountId, projectId, requirementId, recordId);
|
|
125
|
+
const auditMetadata = await getAuditMetadata(auditorContext, accountId, projectId, requirementId, recordId, { shouldSendNotificationToPM });
|
|
120
126
|
|
|
121
127
|
const auditApiConfig = dataTypeUtils.isObject(auditConfig) ?
|
|
122
128
|
auditUtil.parseAuditConfig(cloneObject(auditConfig)) :
|
|
@@ -133,6 +139,7 @@ module.exports = {
|
|
|
133
139
|
audit,
|
|
134
140
|
revertCoi,
|
|
135
141
|
isReaudit,
|
|
142
|
+
wrongCoi,
|
|
136
143
|
getAuditorContractorList,
|
|
137
144
|
getContractorDetailsForAudit,
|
|
138
145
|
getRequirementDetailsForAudit,
|
|
@@ -102,12 +102,13 @@ const getPolicyAuditIdFromRecord = (record, policyName, attributeName) => {
|
|
|
102
102
|
return attribute.auditId;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
// private method - please refer to waiveAll / acceptAll
|
|
106
|
+
const overrideAll = async (record, reason, context, { note = 'OVERRIDDEN AUTOMATICALLY' } = {}) => {
|
|
106
107
|
const allWaivablePolicies = auditUtil.getAllWaivablePolicies(record, context);
|
|
107
108
|
|
|
108
109
|
for (const waivable of allWaivablePolicies) {
|
|
109
110
|
const waiveModel = getWaiveModel(record, waivable.policyName, waivable.attributeName, reason, note);
|
|
110
|
-
const waiveResponse = await
|
|
111
|
+
const waiveResponse = await overrideGap({ waiveRequestModel: waiveModel, context });
|
|
111
112
|
|
|
112
113
|
if (waiveResponse.status !== httpResponseStatusCodes.OK) {
|
|
113
114
|
throw Error(`Failed to waive ${waivable.policyName} - ${waivable.attributeName} for ${record.company}`);
|
|
@@ -115,9 +116,26 @@ const waiveAll = async (record, context, { reason = WAIVER_REASONS.BUSINESS_DECI
|
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
|
|
119
|
+
const waiveAll = async (record, context, { reason = WAIVER_REASONS.BUSINESS_DECISION, note = 'WAIVED AUTOMATICALLY' } = {}) => {
|
|
120
|
+
if (reason === WAIVER_REASONS.ACCEPT_NO_EXPOSURE) {
|
|
121
|
+
throw Error('Invalid override gap reason to waive');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
await overrideAll(record, reason, context, { note });
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const acceptAll = async (record, context, { reason = WAIVER_REASONS.ACCEPT_NO_EXPOSURE, note = 'ACCEPTED AUTOMATICALLY' } = {}) => {
|
|
128
|
+
if (reason !== WAIVER_REASONS.ACCEPT_NO_EXPOSURE) {
|
|
129
|
+
throw Error('Invalid override gap reason to accept');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
await overrideAll(record, reason, context, { note });
|
|
133
|
+
};
|
|
134
|
+
|
|
118
135
|
module.exports = {
|
|
119
136
|
waive,
|
|
120
137
|
waiveAll,
|
|
138
|
+
acceptAll,
|
|
121
139
|
retract,
|
|
122
140
|
getWaiveModel,
|
|
123
141
|
getRetractModel,
|
|
@@ -10,7 +10,7 @@ const Endpoints = {
|
|
|
10
10
|
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
11
11
|
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
12
12
|
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
|
-
sendGaps: `${backendUrl}/saas/
|
|
13
|
+
sendGaps: requestId => `${backendUrl}/saas/request/${requestId}/compliance/status`,
|
|
14
14
|
resendInvitation: requestId => `${backendUrl}/saas/contractor/${requestId}/reminders/reset`,
|
|
15
15
|
requestNewCoiAboutToExpire: requestId => `${backendUrl}/saas/coi/${requestId}/about-to-expire`,
|
|
16
16
|
requestNewCoiExpired: requestId => `${backendUrl}/saas/coi/${requestId}/expired`,
|
|
@@ -50,7 +50,7 @@ const archiveByContractorId = (contractorId, context) => {
|
|
|
50
50
|
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
const
|
|
53
|
+
const restoreRecord = (recordVerificationModel, context) => {
|
|
54
54
|
return requests.postRequestHandler(Endpoints.restore(recordVerificationModel.contractorId), recordVerificationModel, context);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -76,8 +76,8 @@ const assignRequirement = (requestId, assignRequirementModel, context) => {
|
|
|
76
76
|
return requests.putRequestHandler(Endpoints.assignRequirement(requestId), assignRequirementModel, context);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
80
|
-
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
79
|
+
const sendGaps = (requestId, recordModifyDateVerificationModel, context) => {
|
|
80
|
+
return requests.postRequestHandler(Endpoints.sendGaps(requestId), recordModifyDateVerificationModel, context);
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
const requestNewCoiAboutToExpire = (requestId, recordModifyDateVerificationModel, context) => {
|
|
@@ -135,7 +135,7 @@ module.exports = {
|
|
|
135
135
|
getRecordHistory,
|
|
136
136
|
deleteByContractorId,
|
|
137
137
|
archiveByContractorId,
|
|
138
|
-
|
|
138
|
+
restoreRecord,
|
|
139
139
|
editContractor,
|
|
140
140
|
updateInviteDate,
|
|
141
141
|
updateExpiryDate,
|
|
@@ -31,9 +31,9 @@ const archiveByContractorId = (contractorId, context) => {
|
|
|
31
31
|
return contractorsAPI.archiveByContractorId(contractorId, context);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const restoreRecord = (recordVerificationModel, context) => {
|
|
35
35
|
validateType(recordVerificationModel, RecordModifyDateVerificationModel);
|
|
36
|
-
return contractorsAPI.
|
|
36
|
+
return contractorsAPI.restoreRecord(recordVerificationModel, context);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const editContractor = (editRequestModel, context) => {
|
|
@@ -71,9 +71,9 @@ const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
|
71
71
|
return contractorsAPI.changeRequirement(recordModifyDateVerificationModel, context);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
74
|
+
const sendGaps = (requestId, recordModifyDateVerificationModel, context) => {
|
|
75
75
|
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
76
|
-
return contractorsAPI.sendGaps(recordModifyDateVerificationModel, context);
|
|
76
|
+
return contractorsAPI.sendGaps(requestId, recordModifyDateVerificationModel, context);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
const requestNewCoiAboutToExpire = (requestId, recordModifyDateVerificationModel, context) => {
|
|
@@ -140,6 +140,17 @@ const getLinkedProjectsCount = (recordId, context) => {
|
|
|
140
140
|
return contractorsAPI.getLinkedProjectsCount(recordId, context);
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
+
const restoreByRecordId = async (recordId, context) => {
|
|
144
|
+
const recordModifyModel = await getRecordVerificationModel(recordId, context);
|
|
145
|
+
const restoreResponse = await restoreRecord(recordModifyModel, context);
|
|
146
|
+
|
|
147
|
+
if (restoreResponse.status !== httpResponseStatusCodes.OK) {
|
|
148
|
+
throw new Error(`Failed to restore record "${recordId}"\n${restoreResponse.statusText}`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return restoreResponse;
|
|
152
|
+
};
|
|
153
|
+
|
|
143
154
|
module.exports = {
|
|
144
155
|
createContractor,
|
|
145
156
|
changeRequirement,
|
|
@@ -147,7 +158,7 @@ module.exports = {
|
|
|
147
158
|
getContractorById,
|
|
148
159
|
getRecordHistory,
|
|
149
160
|
archiveByContractorId,
|
|
150
|
-
|
|
161
|
+
restoreRecord,
|
|
151
162
|
editContractor,
|
|
152
163
|
updateInviteDate,
|
|
153
164
|
updateExpiryDate,
|
|
@@ -165,5 +176,6 @@ module.exports = {
|
|
|
165
176
|
getRecordVerificationModel,
|
|
166
177
|
assignRequirement,
|
|
167
178
|
getAssignRequirementModel,
|
|
168
|
-
getLinkedProjectsCount
|
|
179
|
+
getLinkedProjectsCount,
|
|
180
|
+
restoreByRecordId
|
|
169
181
|
};
|
|
@@ -87,13 +87,15 @@ const getLastMessage = async (
|
|
|
87
87
|
|
|
88
88
|
// In case the format is 'First Last <username@domain.com>' we need the email part only
|
|
89
89
|
const emailModel = new EmailModel(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
{
|
|
91
|
+
from: util.extractEmailFromNameAndEmailFormat(recipients.from),
|
|
92
|
+
recipientsTo,
|
|
93
|
+
includesOneOfRecipientsTo,
|
|
94
|
+
recipientsCc: recipients.cc,
|
|
95
|
+
textInSubject,
|
|
96
|
+
textInBody,
|
|
97
|
+
excludingPhrasesInBody
|
|
98
|
+
}
|
|
97
99
|
);
|
|
98
100
|
|
|
99
101
|
const response = await getAllMessages(emailModel);
|
|
@@ -2,6 +2,7 @@ const DEFAULT_EMAIL_SENDER = 'hellogetjonestest@gmail.com';
|
|
|
2
2
|
|
|
3
3
|
const EMAIL_TYPES = {
|
|
4
4
|
COMPLIANT: 'compliant',
|
|
5
|
+
NOT_COMPLIANT: 'notCompliant',
|
|
5
6
|
SEND_GAPS: 'sendGaps',
|
|
6
7
|
REQUEST_NEW_COI_EXPIRED: 'requestNewCoiExpired',
|
|
7
8
|
FIRST_REMINDER: 'firstReminder',
|
|
@@ -19,6 +20,8 @@ const EMAIL_TYPES = {
|
|
|
19
20
|
|
|
20
21
|
const EMAIL_SUBJECT = {
|
|
21
22
|
compliant: ({ recordCompanyName }) => `Compliant COI - ${recordCompanyName}`,
|
|
23
|
+
notCompliant: ({ recordCompanyName, requesterName }) => `Please Review COI Gaps - ${recordCompanyName} (${requesterName})`,
|
|
24
|
+
wrongCoi: ({ recordCompanyName, requesterName }) => `Incorrect File Submission - COI Still Required for ${recordCompanyName} - ${requesterName}`,
|
|
22
25
|
sendGaps: ({ requesterName }) => `New Insurance Docs Required for ${requesterName}`, //doesn't includes text for guest or tenant
|
|
23
26
|
requestNewCoiExpired: ({ recordCompanyName }) => `${recordCompanyName}'s COI is`,
|
|
24
27
|
firstReminder: ({ requesterName }) => `We are still awaiting the Insurance Docs for ${requesterName}`,
|
|
@@ -31,7 +34,8 @@ const EMAIL_SUBJECT = {
|
|
|
31
34
|
sameDayExpirationRecordAutoRenewal: ({ requesterName }) => `Your COI for ${requesterName} expires TODAY`,
|
|
32
35
|
sameDayExpirationPMAutoRenewal: ({ recordCompanyName }) => `COI expired for ${recordCompanyName} at`,
|
|
33
36
|
requirementsUpdatedNotification: ({ requesterName }) => `Updated Requirements - Your Insurance Docs are needed for ${requesterName}`,
|
|
34
|
-
updatedRequirementsSubjectPrefix: () => 'Updated Requirements - '
|
|
37
|
+
updatedRequirementsSubjectPrefix: () => 'Updated Requirements - ',
|
|
38
|
+
thankYou: 'Thank you for submitting your COI'
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
module.exports = { DEFAULT_EMAIL_SENDER, EMAIL_TYPES, EMAIL_SUBJECT };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const services = require('./api/db.emails.service');
|
|
2
2
|
const consts = require('./consts/consts');
|
|
3
3
|
const utils = require('./utils/util');
|
|
4
|
+
const { EmailModel } = require('./models/db.emails.model');
|
|
4
5
|
|
|
5
|
-
module.exports = { services, consts, utils };
|
|
6
|
+
module.exports = { services, consts, utils, models: { EmailModel } };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
class EmailModel {
|
|
2
|
-
constructor(
|
|
2
|
+
constructor({
|
|
3
3
|
from,
|
|
4
4
|
recipientsTo,
|
|
5
5
|
includesOneOfRecipientsTo,
|
|
@@ -7,6 +7,7 @@ class EmailModel {
|
|
|
7
7
|
textInSubject,
|
|
8
8
|
textInBody,
|
|
9
9
|
excludingPhrasesInBody
|
|
10
|
+
} = {}
|
|
10
11
|
) {
|
|
11
12
|
this.from = from;
|
|
12
13
|
this.recipientsTo = recipientsTo;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
const { EMAIL_SUBJECT } = require('../consts/consts');
|
|
2
2
|
|
|
3
|
+
//compare method for sorting with ignore caseSensitive
|
|
4
|
+
const compareFn = (a, b) => a.toLowerCase().localeCompare(b.toLowerCase());
|
|
5
|
+
|
|
3
6
|
const compareUnorderedArrays = (arr, other, { caseSensitive = true } = {}) => {
|
|
4
|
-
const isEachElementEqual = arr.sort().every((mail, i) => {
|
|
7
|
+
const isEachElementEqual = arr.sort(compareFn).every((mail, i) => {
|
|
5
8
|
if (caseSensitive) {
|
|
6
|
-
return mail === other.sort()[i];
|
|
9
|
+
return mail === other.sort((compareFn))[i];
|
|
7
10
|
} else {
|
|
8
|
-
return mail.toLowerCase() === other.sort()[i].toLowerCase();
|
|
11
|
+
return mail.toLowerCase() === other.sort(compareFn)[i].toLowerCase();
|
|
9
12
|
}
|
|
10
13
|
});
|
|
11
14
|
return arr.length === other.length && isEachElementEqual;
|
|
@@ -13,7 +13,8 @@ const Endpoints = {
|
|
|
13
13
|
reinvite: `${backendUrl}/saas/project/team-member/reinvite`,
|
|
14
14
|
getUserEncryptedData: (email, userRole) => `${backendUrl}/saas/team-member/email/${email}/role/${userRole}/signup-data`,
|
|
15
15
|
signupUser: `${backendUrl}/_saas/guests/signup`,
|
|
16
|
-
removeAllUserTraceFromDb: userId => `${backendUrl}/saas/user/automation/${userId}
|
|
16
|
+
removeAllUserTraceFromDb: userId => `${backendUrl}/saas/user/automation/${userId}`,
|
|
17
|
+
userEmailNotificationsSettings: `${backendUrl}/saas/account/notification/set`
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
const invite = (invitedUser, context, { disableSendMail = true } = {}) => {
|
|
@@ -62,6 +63,11 @@ const reinviteUser = (userId, context) => {
|
|
|
62
63
|
return requests.postRequestHandler(Endpoints.reinvite, {}, context, {}, params);
|
|
63
64
|
};
|
|
64
65
|
|
|
66
|
+
const editUserEmailNotificationsSettings = (userId, notificationSettingsModel, context) => {
|
|
67
|
+
const params = { userId };
|
|
68
|
+
return requests.postRequestHandler(Endpoints.userEmailNotificationsSettings, notificationSettingsModel, context, {}, params);
|
|
69
|
+
};
|
|
70
|
+
|
|
65
71
|
module.exports = {
|
|
66
72
|
invite,
|
|
67
73
|
signupUser,
|
|
@@ -73,5 +79,6 @@ module.exports = {
|
|
|
73
79
|
removeAllUserTraceFromDb,
|
|
74
80
|
editUserRole,
|
|
75
81
|
editUserProjects,
|
|
76
|
-
reinviteUser
|
|
82
|
+
reinviteUser,
|
|
83
|
+
editUserEmailNotificationsSettings
|
|
77
84
|
};
|
|
@@ -5,6 +5,7 @@ const { credentials } = getEnv();
|
|
|
5
5
|
const userAPI = require('./users.api');
|
|
6
6
|
const util = require('../utils/util');
|
|
7
7
|
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
8
|
+
const { NotificationSettingsModel } = require('../models/notification.settings.model');
|
|
8
9
|
|
|
9
10
|
const inviteUser = async (invitedUser, context, { disableSendMail } = {}) => {
|
|
10
11
|
return userAPI.invite(invitedUser, context, { disableSendMail });
|
|
@@ -85,6 +86,11 @@ const reinviteUser = (userId, context) => {
|
|
|
85
86
|
return userAPI.reinviteUser(userId, context);
|
|
86
87
|
};
|
|
87
88
|
|
|
89
|
+
const editUserEmailNotificationsSettings = (userId, notificationSettingsModel, context) => {
|
|
90
|
+
validateType(notificationSettingsModel, NotificationSettingsModel);
|
|
91
|
+
return userAPI.editUserEmailNotificationsSettings(userId, notificationSettingsModel, context);
|
|
92
|
+
};
|
|
93
|
+
|
|
88
94
|
module.exports = {
|
|
89
95
|
inviteUser,
|
|
90
96
|
signupUser,
|
|
@@ -97,5 +103,6 @@ module.exports = {
|
|
|
97
103
|
removeAllUserTraceFromDb,
|
|
98
104
|
editUserRole,
|
|
99
105
|
editUserProjects,
|
|
100
|
-
reinviteUser
|
|
106
|
+
reinviteUser,
|
|
107
|
+
editUserEmailNotificationsSettings
|
|
101
108
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const userModels = require('./models/users.model');
|
|
2
|
+
const { NotificationSettingsModel } = require('./models/notification.settings.model');
|
|
2
3
|
const services = require('./api/users.service');
|
|
3
4
|
const util = require('./utils/util');
|
|
4
5
|
|
|
@@ -8,4 +9,6 @@ const tenants = {
|
|
|
8
9
|
services: tenantUserService
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const models = { ... userModels, NotificationSettingsModel };
|
|
13
|
+
|
|
11
14
|
module.exports = { services, models, util, tenants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class NotificationSettingsModel {
|
|
2
|
+
constructor({ aboutToExpire = true, auditCompliant = true, auditNotCompliant = true, missingCoi = true } = {}) {
|
|
3
|
+
this.aboutToExpire = aboutToExpire;
|
|
4
|
+
this.auditCompliant = auditCompliant;
|
|
5
|
+
this.auditNotCompliant = auditNotCompliant;
|
|
6
|
+
this.missingCoi = missingCoi;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
NotificationSettingsModel
|
|
12
|
+
};
|