@getjones/test-infra 2.9.11 → 2.10.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 +1 -1
- package/src/defaults/configs/polices.js +1 -0
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +18 -0
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +40 -1
- package/src/saas/internal-api/compliance/consts/audit.js +9 -1
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +9 -1
- package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +20 -0
- package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +39 -0
- package/src/saas/internal-api/emailCustomization/index.js +3 -0
- package/src/saas/openapi/projects/projects.api.js +36 -12
- package/src/saas/openapi/projects/projects.service.js +21 -1
- package/src/saas/openapi/tabs/tabs.api.js +6 -2
- package/src/saas/openapi/tabs/tabs.service.js +6 -1
package/package.json
CHANGED
|
@@ -13,6 +13,9 @@ const Endpoints = {
|
|
|
13
13
|
revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert`,
|
|
14
14
|
wrongCoi: `${backendUrl}/saas/coi/wrong-coi`,
|
|
15
15
|
getAudit: recordId => `${backendUrl}/saas/audit/${recordId}`,
|
|
16
|
+
putAuditOnHold: `${backendUrl}/saas/auditor/put-on-hold`,
|
|
17
|
+
resumeAudit: onHoldId => `${backendUrl}/saas/auditor/on-hold/${onHoldId}/resume`,
|
|
18
|
+
getAuditIfIsOnHold: auditId => `${backendUrl}/saas/auditor/on-hold/latest/audit/${auditId}`,
|
|
16
19
|
updateComplianceAuditActionsDate: recordId => `${backendUrl}/saas/automation/record/${recordId}/update-audit-actions-date`
|
|
17
20
|
};
|
|
18
21
|
|
|
@@ -58,6 +61,18 @@ const wrongCoi = (recordId, context) => {
|
|
|
58
61
|
return requests.getRequestHandler(Endpoints.wrongCoi, params, context);
|
|
59
62
|
};
|
|
60
63
|
|
|
64
|
+
const putAuditOnHold = (onHoldModel, context) => {
|
|
65
|
+
return requests.postRequestHandler(Endpoints.putAuditOnHold, onHoldModel, context);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const resumeAudit = (onHoldId, context) => {
|
|
69
|
+
return requests.putRequestHandler(Endpoints.resumeAudit(onHoldId), {}, context);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getAuditIfIsOnHold = (auditId, context) => {
|
|
73
|
+
return requests.getRequestHandler(Endpoints.getAuditIfIsOnHold(auditId), {}, context);
|
|
74
|
+
};
|
|
75
|
+
|
|
61
76
|
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
62
77
|
const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?offsetInDays=${dateOffset}`;
|
|
63
78
|
return requests.putRequestHandler(url, {}, context);
|
|
@@ -74,5 +89,8 @@ module.exports = {
|
|
|
74
89
|
getAuditRecordModel,
|
|
75
90
|
getRequirementDetailsForAudit,
|
|
76
91
|
getAuditByRecordId,
|
|
92
|
+
putAuditOnHold,
|
|
93
|
+
resumeAudit,
|
|
94
|
+
getAuditIfIsOnHold,
|
|
77
95
|
updateComplianceAuditActionsDate
|
|
78
96
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const auditApi = require('./audit.api');
|
|
2
|
-
const { AuditRequestModel, AuditListParametersModel, AuditDatesModel } = require('../../models/audit/audit.model');
|
|
2
|
+
const { AuditRequestModel, AuditListParametersModel, AuditDatesModel, AuditOnHoldModel } = require('../../models/audit/audit.model');
|
|
3
3
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
4
4
|
const auditUtil = require('../../utils/auditUtil');
|
|
5
5
|
const dataTypeUtils = require('../../../../../common/utils/dataTypeUtils');
|
|
@@ -157,6 +157,42 @@ const auditRecord = async function(
|
|
|
157
157
|
return auditResponse;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
+
const getOnHoldModel = (auditId, onHoldReason) => {
|
|
161
|
+
return new AuditOnHoldModel(auditId, onHoldReason);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const putAuditOnHold = async function(auditId, onHoldReason, context) {
|
|
165
|
+
const onHoldModel = getOnHoldModel(auditId, onHoldReason);
|
|
166
|
+
|
|
167
|
+
const onHoldResponse = await auditApi.putAuditOnHold(onHoldModel, context);
|
|
168
|
+
|
|
169
|
+
if (onHoldResponse.status !== httpResponseStatusCodes.OK) {
|
|
170
|
+
throw Error(`Failed to put audit on hold\n${onHoldResponse}`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return onHoldResponse.data;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const resumeAudit = async function(onHoldId, context) {
|
|
177
|
+
const resumeAuditResponse = await auditApi.resumeAudit(onHoldId, context);
|
|
178
|
+
|
|
179
|
+
if (resumeAuditResponse.status !== httpResponseStatusCodes.OK) {
|
|
180
|
+
throw Error(`Failed to resume audit\n${resumeAuditResponse}`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return resumeAuditResponse.data;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const getAuditIfIsOnHold = async function(auditId, context) {
|
|
187
|
+
const getAuditResponse = await auditApi.getAuditIfIsOnHold(auditId, context);
|
|
188
|
+
|
|
189
|
+
if (getAuditResponse.status !== httpResponseStatusCodes.OK) {
|
|
190
|
+
throw Error(`Failed to get audit when it's on hold\n${getAuditResponse}`);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return getAuditResponse.data;
|
|
194
|
+
};
|
|
195
|
+
|
|
160
196
|
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
161
197
|
return auditApi.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
162
198
|
};
|
|
@@ -176,5 +212,8 @@ module.exports = {
|
|
|
176
212
|
getAuditByRecordId,
|
|
177
213
|
getAuditRequestModel,
|
|
178
214
|
auditRecord,
|
|
215
|
+
putAuditOnHold,
|
|
216
|
+
resumeAudit,
|
|
217
|
+
getAuditIfIsOnHold,
|
|
179
218
|
updateComplianceAuditActionsDate
|
|
180
219
|
};
|
|
@@ -77,6 +77,13 @@ const auditStatus = {
|
|
|
77
77
|
canceled: 'CANCELED'
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
const auditOnHoldReason = {
|
|
81
|
+
ESCALATION_TO_PM: 'Escalation to PM',
|
|
82
|
+
ISSUE_WITH_REQUIREMENTS: 'Issue with Requirements',
|
|
83
|
+
REQUIREMENTS_UPDATE: 'Requirements Update',
|
|
84
|
+
INTERNAL_DISCUSSION: 'Internal Discussion'
|
|
85
|
+
};
|
|
86
|
+
|
|
80
87
|
module.exports = {
|
|
81
88
|
DEFAULT_POLICY_ID,
|
|
82
89
|
POLICY_NAMES_MAP,
|
|
@@ -86,5 +93,6 @@ module.exports = {
|
|
|
86
93
|
AUDIT_ENTITY_STATUSES,
|
|
87
94
|
VALID_SCORES,
|
|
88
95
|
auditTriggerType,
|
|
89
|
-
auditStatus
|
|
96
|
+
auditStatus,
|
|
97
|
+
auditOnHoldReason
|
|
90
98
|
};
|
|
@@ -78,9 +78,17 @@ class AuditListParametersModel {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
class AuditOnHoldModel {
|
|
82
|
+
constructor(auditId, onHoldReason) {
|
|
83
|
+
this.auditId = auditId;
|
|
84
|
+
this.reason = onHoldReason;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
81
88
|
module.exports = {
|
|
82
89
|
AuditRequestModel,
|
|
83
90
|
AuditEntityModel,
|
|
84
91
|
AuditDatesModel,
|
|
85
|
-
AuditListParametersModel
|
|
92
|
+
AuditListParametersModel,
|
|
93
|
+
AuditOnHoldModel
|
|
86
94
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
getCustomizationsByAccountId: accountId => `${backendUrl}/saas/email-customizations?accountId=${accountId}`,
|
|
6
|
+
deleteById: id => `${backendUrl}/saas/email-customization/${id}/permanently`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getEmailCustomizationsByAccountId = (accountId, context) => {
|
|
10
|
+
return requests.getRequestHandler(Endpoints.getCustomizationsByAccountId(accountId), {}, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const deleteEmailCustomizationById = (id, context) => {
|
|
14
|
+
return requests.deleteRequestHandler(Endpoints.deleteById(id), context);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
getEmailCustomizationsByAccountId,
|
|
19
|
+
deleteEmailCustomizationById
|
|
20
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
2
|
+
|
|
3
|
+
const emailCustomizationApi = require('./email.customization.api');
|
|
4
|
+
|
|
5
|
+
const getEmailCustomizationsByAccountId = async (accountId, context) => {
|
|
6
|
+
const resp = await emailCustomizationApi.getEmailCustomizationsByAccountId(accountId, context);
|
|
7
|
+
|
|
8
|
+
if (resp.status !== httpResponseStatusCodes.OK) {
|
|
9
|
+
throw new Error(`Failed to get email customization by account id ${accountId}`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return resp.data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const deleteEmailCustomizationById = async (id, context) => {
|
|
16
|
+
const resp = await emailCustomizationApi.deleteEmailCustomizationById(id, context);
|
|
17
|
+
|
|
18
|
+
if (resp.status !== httpResponseStatusCodes.OK) {
|
|
19
|
+
throw new Error(`Failed to delete email customization by id ${id}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return resp;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const deleteAllEmailCustomizationsInAccount = async (accountId, context) => {
|
|
26
|
+
const customizationList = await getEmailCustomizationsByAccountId(accountId, context);
|
|
27
|
+
|
|
28
|
+
for (const customization of customizationList) {
|
|
29
|
+
if (customization.id) {
|
|
30
|
+
await deleteEmailCustomizationById(customization.id, context);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
getEmailCustomizationsByAccountId,
|
|
37
|
+
deleteEmailCustomizationById,
|
|
38
|
+
deleteAllEmailCustomizationsInAccount
|
|
39
|
+
};
|
|
@@ -9,44 +9,64 @@ const Endpoints = {
|
|
|
9
9
|
updateProject: projectId => `${openapiUrl}/properties/${projectId}`,
|
|
10
10
|
getProjectSettings: projectId => `${openapiUrl}/properties/${projectId}/settings`,
|
|
11
11
|
updateProjectSettings: projectId => `${openapiUrl}/properties/${projectId}/settings`,
|
|
12
|
-
getProjectServiceArea: (city, state) => `${openapiUrl}/properties/service-area?city=${city}&state=${state}
|
|
12
|
+
getProjectServiceArea: (city, state) => `${openapiUrl}/properties/service-area?city=${city}&state=${state}`,
|
|
13
|
+
archiveProject: projectId => `${openapiUrl}/properties/${projectId}/archive`,
|
|
14
|
+
restoreProject: projectId => `${openapiUrl}/properties/${projectId}/restore`,
|
|
15
|
+
addUserToProject: (projectId, userId) => `${openapiUrl}/properties/${projectId}/users/${userId}`,
|
|
16
|
+
removeUserFromProject: (projectId, userId) => `${openapiUrl}/properties/${projectId}/users/${userId}`
|
|
13
17
|
};
|
|
14
18
|
|
|
15
|
-
const getProjectsByName =
|
|
19
|
+
const getProjectsByName = (apiKey, params) => {
|
|
16
20
|
return requests.getRequestHandler(Endpoints.getProjectsByName, apiKey, params).then(res => res.data);
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
const getAllProjects =
|
|
23
|
+
const getAllProjects = (apiKey, params) => {
|
|
20
24
|
return requests.getRequestHandler(Endpoints.getAllProjects, apiKey, params).then(res => res);
|
|
21
25
|
};
|
|
22
26
|
|
|
23
|
-
const getModifiedProjects =
|
|
27
|
+
const getModifiedProjects = (apiKey, params) => {
|
|
24
28
|
return requests.getRequestHandler(Endpoints.getModifiedProjects, apiKey, params).then(res => res.data);
|
|
25
29
|
};
|
|
26
30
|
|
|
27
|
-
const createProject =
|
|
31
|
+
const createProject = (apiKey, project) => {
|
|
28
32
|
return requests.postRequestHandler(Endpoints.createProject, apiKey, project).then(res => res.data);
|
|
29
33
|
};
|
|
30
34
|
|
|
31
|
-
const updateProject =
|
|
32
|
-
return requests.patchRequestHandler(Endpoints.updateProject(projectId), apiKey, projectData).then(res => res
|
|
35
|
+
const updateProject = (apiKey, projectId, projectData) => {
|
|
36
|
+
return requests.patchRequestHandler(Endpoints.updateProject(projectId), apiKey, projectData).then(res => res);
|
|
33
37
|
};
|
|
34
38
|
|
|
35
|
-
const updateProjectSettings =
|
|
39
|
+
const updateProjectSettings = (apiKey, projectId, projectSettings) => {
|
|
36
40
|
return requests.patchRequestHandler(Endpoints.updateProjectSettings(projectId),
|
|
37
41
|
apiKey,
|
|
38
|
-
projectSettings).then(res => res
|
|
42
|
+
projectSettings).then(res => res);
|
|
39
43
|
};
|
|
40
44
|
|
|
41
|
-
const getProjectSettings =
|
|
45
|
+
const getProjectSettings = (apiKey, projectId) => {
|
|
42
46
|
return requests.getRequestHandler(Endpoints.getProjectSettings(projectId),
|
|
43
47
|
apiKey).then(res => res.data);
|
|
44
48
|
};
|
|
45
49
|
|
|
46
|
-
const getProjectServiceArea =
|
|
50
|
+
const getProjectServiceArea = (apiKey, city, state) => {
|
|
47
51
|
return requests.getRequestHandler(Endpoints.getProjectServiceArea(city, state), apiKey);
|
|
48
52
|
};
|
|
49
53
|
|
|
54
|
+
const archiveProject = (apiKey, projectId) => {
|
|
55
|
+
return requests.postRequestHandler(Endpoints.archiveProject(projectId), apiKey);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const restoreProject = (apiKey, projectId) => {
|
|
59
|
+
return requests.postRequestHandler(Endpoints.restoreProject(projectId), apiKey);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const addUserToProject = (apiKey, projectId, userId) => {
|
|
63
|
+
return requests.patchRequestHandler(Endpoints.addUserToProject(projectId, userId), apiKey);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const removeUserFromProject = (apiKey, projectId, userId) => {
|
|
67
|
+
return requests.deleteRequestHandler(Endpoints.removeUserFromProject(projectId, userId), apiKey);
|
|
68
|
+
};
|
|
69
|
+
|
|
50
70
|
module.exports = {
|
|
51
71
|
getProjectsByName,
|
|
52
72
|
getAllProjects,
|
|
@@ -55,5 +75,9 @@ module.exports = {
|
|
|
55
75
|
updateProject,
|
|
56
76
|
updateProjectSettings,
|
|
57
77
|
getProjectSettings,
|
|
58
|
-
getProjectServiceArea
|
|
78
|
+
getProjectServiceArea,
|
|
79
|
+
archiveProject,
|
|
80
|
+
restoreProject,
|
|
81
|
+
addUserToProject,
|
|
82
|
+
removeUserFromProject
|
|
59
83
|
};
|
|
@@ -32,6 +32,22 @@ const getProjectServiceArea = async (apiKey, city, state) => {
|
|
|
32
32
|
return projectsApi.getProjectServiceArea(apiKey, city, state);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
const archiveProject = async (apiKey, projectId) => {
|
|
36
|
+
return projectsApi.archiveProject(apiKey, projectId);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const restoreProject = async (apiKey, projectId) => {
|
|
40
|
+
return projectsApi.restoreProject(apiKey, projectId);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const addUserToProject = async (apiKey, projectId, userId) => {
|
|
44
|
+
return projectsApi.addUserToProject(apiKey, projectId, userId);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const removeUserFromProject = async (apiKey, projectId, userId) => {
|
|
48
|
+
return projectsApi.removeUserFromProject(apiKey, projectId, userId);
|
|
49
|
+
};
|
|
50
|
+
|
|
35
51
|
module.exports = {
|
|
36
52
|
getProjectsByName,
|
|
37
53
|
createProject,
|
|
@@ -40,5 +56,9 @@ module.exports = {
|
|
|
40
56
|
getModifiedProjects,
|
|
41
57
|
updateProjectSettings,
|
|
42
58
|
getProjectSettings,
|
|
43
|
-
getProjectServiceArea
|
|
59
|
+
getProjectServiceArea,
|
|
60
|
+
archiveProject,
|
|
61
|
+
restoreProject,
|
|
62
|
+
addUserToProject,
|
|
63
|
+
removeUserFromProject
|
|
44
64
|
};
|
|
@@ -5,7 +5,8 @@ const Endpoints = {
|
|
|
5
5
|
delete: tabId => `${openapiUrl}/tabs/${tabId}`,
|
|
6
6
|
get: tabId => `${backendUrl}/tabs/${tabId}`,
|
|
7
7
|
create: projectId => `${openapiUrl}/properties/${projectId}/tab`,
|
|
8
|
-
getAll: `${openapiUrl}/tabs/all
|
|
8
|
+
getAll: `${openapiUrl}/tabs/all`,
|
|
9
|
+
getProjectTabs: projectId => `${openapiUrl}/properties/${projectId}/tabs`
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
const deleteTabById = (tabId, apiKey) => {
|
|
@@ -20,4 +21,7 @@ const getAllTabs = (apiKey, params) => {
|
|
|
20
21
|
return requests.getRequestHandler(Endpoints.getAll, apiKey, params);
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
const getProjectTabs = (projectId, apiKey) => {
|
|
25
|
+
return requests.getRequestHandler(Endpoints.getProjectTabs(projectId), apiKey);
|
|
26
|
+
};
|
|
27
|
+
module.exports = { deleteTabById, createTab, getAllTabs, getProjectTabs };
|
|
@@ -11,4 +11,9 @@ const createTab = (projectId, createTabModel, apiKey) => {
|
|
|
11
11
|
const getAllTabs = (apiKey, params) => {
|
|
12
12
|
return tabsApi.getAllTabs(apiKey, params);
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
const getProjectTabs = (projectId, apiKey) => {
|
|
16
|
+
return tabsApi.getProjectTabs(projectId, apiKey);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
module.exports = { deleteTabById, createTab, getAllTabs, getProjectTabs };
|