@getjones/test-infra 2.9.11 → 2.9.111
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/factory/users/users.js +1 -3
- package/src/index.js +3 -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/contractors/api/contractors.api.js +8 -2
- package/src/saas/internal-api/contractors/api/contractors.service.js +6 -1
- package/src/saas/internal-api/dbEmails/consts/consts.js +5 -1
- package/src/saas/internal-api/dbEmails/utils/util.js +12 -1
- package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -0
- package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -0
- package/src/saas/internal-api/emailCustomization/index.js +3 -0
- package/src/saas/internal-api/requirements/index.js +2 -1
- 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/src/resources/virusFile.pdf +0 -0
package/package.json
CHANGED
|
@@ -13,8 +13,6 @@ const roles = {
|
|
|
13
13
|
cm: 'Compliance Manager'
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const generateFullName = role => `${role} User`;
|
|
17
|
-
|
|
18
16
|
const inviteSaasUser = async (username, role, projectIds, context) => {
|
|
19
17
|
const userResponse = await users.services.getUserByEmail(username, context);
|
|
20
18
|
|
|
@@ -38,7 +36,7 @@ const signupSaasUser = async (username, role, context) => {
|
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
const signupUserModel = await users.util.getSignupUserModel(username, role,
|
|
39
|
+
const signupUserModel = await users.util.getSignupUserModel(username, role, role, defaultsPassword, context);
|
|
42
40
|
const signupResponse = await users.services.signupUser(signupUserModel, context);
|
|
43
41
|
|
|
44
42
|
if (signupResponse.status !== httpResponseStatusCodes.OK) {
|
package/src/index.js
CHANGED
|
@@ -41,6 +41,8 @@ const getInternalAPI = () => {
|
|
|
41
41
|
const agreement = require('./saas/internal-api/agreement/index');
|
|
42
42
|
const uploadFile = require('./saas/internal-api/uploadFiles/index');
|
|
43
43
|
|
|
44
|
+
const emailCustomization = require('./saas/internal-api/emailCustomization');
|
|
45
|
+
|
|
44
46
|
const internalAPI = {
|
|
45
47
|
defaults,
|
|
46
48
|
auth,
|
|
@@ -63,6 +65,7 @@ const getInternalAPI = () => {
|
|
|
63
65
|
requestsTable,
|
|
64
66
|
threadScheduler,
|
|
65
67
|
dbEmails,
|
|
68
|
+
emailCustomization,
|
|
66
69
|
factory,
|
|
67
70
|
agreement,
|
|
68
71
|
uploadFile
|
|
@@ -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.data.message}`);
|
|
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.data.message}`);
|
|
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
|
};
|
|
@@ -25,7 +25,8 @@ const Endpoints = {
|
|
|
25
25
|
`${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
26
26
|
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
27
27
|
assignRequirement: requestId => `${backendUrl}/saas/contractor/${requestId}/assign-requirement`,
|
|
28
|
-
linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects
|
|
28
|
+
linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects`,
|
|
29
|
+
verifyInviteLink: encryptedData => `${backendUrl}/vendor-app/verify-link?data=${encryptedData}`
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const createContractor = (createContractorModel, context) => {
|
|
@@ -133,6 +134,10 @@ const updateLastInviteActionDate = (recordId, offsetInDays, context) => {
|
|
|
133
134
|
return requests.putRequestHandler(url, {}, context);
|
|
134
135
|
};
|
|
135
136
|
|
|
137
|
+
const getInviteLinkStatus = (encryptedData, context) => {
|
|
138
|
+
return requests.getRequestHandler(Endpoints.verifyInviteLink(encryptedData), {}, context, {});
|
|
139
|
+
};
|
|
140
|
+
|
|
136
141
|
module.exports = {
|
|
137
142
|
createContractor,
|
|
138
143
|
changeRequirement,
|
|
@@ -156,5 +161,6 @@ module.exports = {
|
|
|
156
161
|
muteNotifications,
|
|
157
162
|
unmuteNotifications,
|
|
158
163
|
getLinkedProjectsCount,
|
|
159
|
-
updateLastInviteActionDate
|
|
164
|
+
updateLastInviteActionDate,
|
|
165
|
+
getInviteLinkStatus
|
|
160
166
|
};
|
|
@@ -162,6 +162,10 @@ const restoreByRecordId = async (recordId, context) => {
|
|
|
162
162
|
return restoreResponse;
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
+
const getInviteLinkStatus = (encryptedData, context) => {
|
|
166
|
+
return contractorsAPI.getInviteLinkStatus(encryptedData, context);
|
|
167
|
+
};
|
|
168
|
+
|
|
165
169
|
module.exports = {
|
|
166
170
|
createContractor,
|
|
167
171
|
changeRequirement,
|
|
@@ -189,5 +193,6 @@ module.exports = {
|
|
|
189
193
|
getAssignRequirementModel,
|
|
190
194
|
getLinkedProjectsCount,
|
|
191
195
|
restoreByRecordId,
|
|
192
|
-
updateLastInviteActionDate
|
|
196
|
+
updateLastInviteActionDate,
|
|
197
|
+
getInviteLinkStatus
|
|
193
198
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const DEFAULT_EMAIL_SENDER = 'hellogetjonestest@gmail.com';
|
|
2
2
|
|
|
3
|
+
const tenantUserExtension = externalCompanyName => ` and ${externalCompanyName}`;
|
|
4
|
+
|
|
3
5
|
const EMAIL_TYPES = {
|
|
6
|
+
INVITE: 'invite',
|
|
4
7
|
COMPLIANT: 'compliant',
|
|
5
8
|
NOT_COMPLIANT: 'notCompliant',
|
|
6
9
|
SEND_GAPS: 'sendGaps',
|
|
@@ -20,6 +23,7 @@ const EMAIL_TYPES = {
|
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
const EMAIL_SUBJECT = {
|
|
26
|
+
invite: 'Your Insurance Docs are needed for',
|
|
23
27
|
compliant: ({ recordCompanyName }) => `Compliant COI - ${recordCompanyName}`,
|
|
24
28
|
sendGaps: ({ requesterName }) => `New Insurance Docs Required for ${requesterName} - `, //For this email type, guest is the same as vendor
|
|
25
29
|
sendGapsForTenant: ({ requesterName }) => `New Insurance Docs Required for leased space at ${requesterName} - `,
|
|
@@ -46,4 +50,4 @@ const EMAIL_SUBJECT = {
|
|
|
46
50
|
thankYou: 'Thank you for submitting your COI'
|
|
47
51
|
};
|
|
48
52
|
|
|
49
|
-
module.exports = { DEFAULT_EMAIL_SENDER, EMAIL_TYPES, EMAIL_SUBJECT };
|
|
53
|
+
module.exports = { DEFAULT_EMAIL_SENDER, EMAIL_TYPES, EMAIL_SUBJECT, tenantUserExtension };
|
|
@@ -62,10 +62,21 @@ const getEmailTextInSubject = (recordCompanyName, emailType, isAfterUpdateRequir
|
|
|
62
62
|
return isAfterUpdateRequirements ? `Updated Requirements - ${subject}` : subject;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
const getMailActionButtonUrlRegex = () => {
|
|
66
|
+
return /(https:\/\/[a-zA-Z0-9.].*[a-zA-Z.]+\/CheckCustomersInviteLinkJSON\?data=[^"]+)/g;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const getEncryptedDataFromLink = link => {
|
|
70
|
+
const encryptedData = link.split('data=').pop();
|
|
71
|
+
return encryptedData.slice(0, -2);
|
|
72
|
+
};
|
|
73
|
+
|
|
65
74
|
module.exports = {
|
|
66
75
|
recipientsMatchVerification,
|
|
67
76
|
regexVerification,
|
|
68
77
|
extractEmailFromNameAndEmailFormat,
|
|
69
78
|
logRetrievedEmailInfo,
|
|
70
|
-
getEmailTextInSubject
|
|
79
|
+
getEmailTextInSubject,
|
|
80
|
+
getMailActionButtonUrlRegex,
|
|
81
|
+
getEncryptedDataFromLink
|
|
71
82
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
restoreDefaultById: id => `${backendUrl}/saas/email-customization/${id}/restore?version=DEFAULT`,
|
|
7
|
+
deletePermanentlyById: id => `${backendUrl}/saas/email-customization/${id}/permanently`
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const getEmailCustomizationsByAccountId = (accountId, context) => {
|
|
11
|
+
return requests.getRequestHandler(Endpoints.getCustomizationsByAccountId(accountId), {}, context);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const restoreDefaultById = (id, context) => {
|
|
15
|
+
return requests.postRequestHandler(Endpoints.restoreDefaultById(id), {}, context);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const deleteEmailCustomizationPermanentlyById = (id, context) => {
|
|
19
|
+
return requests.deleteRequestHandler(Endpoints.deletePermanentlyById(id), context);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
getEmailCustomizationsByAccountId,
|
|
24
|
+
restoreDefaultById,
|
|
25
|
+
deleteEmailCustomizationPermanentlyById
|
|
26
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
2
|
+
|
|
3
|
+
const emailCustomizationApi = require('./email.customization.api');
|
|
4
|
+
|
|
5
|
+
const getEmailCustomizationsByAccountId = async (accountId, context) => {
|
|
6
|
+
const response = await emailCustomizationApi.getEmailCustomizationsByAccountId(accountId, context);
|
|
7
|
+
|
|
8
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
9
|
+
throw new Error(`Failed to get email customization by account id ${accountId}`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return response.data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const restoreDefaultById = async (id, context) => {
|
|
16
|
+
const response = await emailCustomizationApi.restoreDefaultById(id, context);
|
|
17
|
+
|
|
18
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
19
|
+
throw new Error(`Failed to delete email customization by id ${id}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return response;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const deleteEmailCustomizationPermanentlyById = async (id, context) => {
|
|
26
|
+
const response = await emailCustomizationApi.deleteEmailCustomizationPermanentlyById(id, context);
|
|
27
|
+
|
|
28
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
29
|
+
throw new Error(`Failed to delete email customization by id ${id}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return response;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const restoreAllEmailCustomizationsInAccount = async (accountId, context) => {
|
|
36
|
+
const customizationList = await getEmailCustomizationsByAccountId(accountId, context);
|
|
37
|
+
|
|
38
|
+
for (const customization of customizationList) {
|
|
39
|
+
if (customization.id) {
|
|
40
|
+
await restoreDefaultById(customization.id, context);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = {
|
|
46
|
+
getEmailCustomizationsByAccountId,
|
|
47
|
+
restoreDefaultById,
|
|
48
|
+
deleteEmailCustomizationPermanentlyById,
|
|
49
|
+
restoreAllEmailCustomizationsInAccount
|
|
50
|
+
};
|
|
@@ -3,7 +3,8 @@ const updateModel = require('./models/update.requirement.model');
|
|
|
3
3
|
const policyModel = require('./models/policy.model');
|
|
4
4
|
const services = require('./api/requirements.service');
|
|
5
5
|
const consts = require('./consts/consts');
|
|
6
|
+
const utils = require('./utils/utils');
|
|
6
7
|
|
|
7
8
|
const models = { create: createModel, update: updateModel, policy: policyModel };
|
|
8
9
|
|
|
9
|
-
module.exports = { services, models, consts };
|
|
10
|
+
module.exports = { services, models, consts, utils };
|
|
@@ -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 };
|
|
Binary file
|