@getjones/test-infra 2.14.0 → 3.0.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/.npmrc.bak +2 -0
- package/package.json +30 -30
- package/package.json.bak +30 -0
- package/src/common/commonFlows/auth/auth.js +40 -40
- package/src/common/commonFlows/index.js +4 -4
- package/src/common/commonFlows/records/records.js +102 -102
- package/src/common/consts/activationStatuses.js +6 -6
- package/src/common/consts/dashboardCharts.js +18 -18
- package/src/common/consts/projectSettings.js +6 -6
- package/src/common/consts/recordTypes.js +5 -5
- package/src/common/consts/s3FileTypes.js +12 -12
- package/src/common/consts/userTypes.js +8 -8
- package/src/common/errorCodes.js +3 -3
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/requests/apiKeyAuth/requests.js +44 -44
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/internalAuth/requests.js +48 -38
- package/src/common/requests/requestHandlers.js +78 -78
- package/src/common/utils/complianceUtil.js +83 -83
- package/src/common/utils/configsUtil.js +22 -22
- package/src/common/utils/dataTypeUtils.js +41 -41
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/objectUtils.js +7 -7
- package/src/common/utils/timeUtils.js +177 -177
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/auditConfigs.js +91 -91
- package/src/defaults/configs/coverage.js +227 -227
- package/src/defaults/configs/polices.js +64 -64
- package/src/defaults/configs/requirement.js +32 -32
- package/src/defaults/index.js +6 -6
- package/src/env.js +57 -57
- package/src/factory/globalRecord/globalRecord.js +70 -70
- package/src/factory/index.js +8 -8
- package/src/factory/records/records.js +183 -183
- package/src/factory/users/users.js +77 -77
- package/src/index.js +91 -91
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +35 -35
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +93 -93
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.api.js +29 -29
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.service.js +61 -61
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +41 -41
- package/src/saas/internal-api/accounts/consts/consts.js +6 -6
- package/src/saas/internal-api/accounts/index.js +22 -22
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +38 -38
- package/src/saas/internal-api/accounts/utils/utils.js +58 -58
- package/src/saas/internal-api/agreement/api/agreement.api.js +35 -35
- package/src/saas/internal-api/agreement/api/agreement.service.js +81 -81
- package/src/saas/internal-api/agreement/consts/consts.js +8 -8
- package/src/saas/internal-api/agreement/index.js +11 -11
- package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.api.js +43 -43
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.service.js +105 -105
- package/src/saas/internal-api/auditCustomerRules/consts/customer.rule.js +11 -11
- package/src/saas/internal-api/auditCustomerRules/index.js +6 -6
- package/src/saas/internal-api/auditCustomerRules/models/customer.rule.model.js +46 -46
- package/src/saas/internal-api/auditCustomerRules/utils/customer.rule.util.js +19 -19
- package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
- package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +115 -115
- package/src/saas/internal-api/auditNotes/index.js +4 -4
- package/src/saas/internal-api/auditNotes/models/audit.note.model.js +30 -30
- package/src/saas/internal-api/auth/api/auth.api.js +27 -27
- package/src/saas/internal-api/auth/api/auth.service.js +90 -90
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +40 -34
- package/src/saas/internal-api/coi/api/coi.service.js +26 -22
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +5 -5
- package/src/saas/internal-api/coi/index.js +13 -13
- package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
- package/src/saas/internal-api/coi/utils/utils.js +48 -48
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +100 -100
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +230 -230
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +48 -48
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +33 -33
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +141 -141
- package/src/saas/internal-api/compliance/consts/audit.js +103 -103
- package/src/saas/internal-api/compliance/index.js +33 -33
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +94 -94
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -49
- package/src/saas/internal-api/compliance/utils/auditUtil.js +222 -222
- package/src/saas/internal-api/compliance/utils/coverageUtil.js +40 -40
- package/src/saas/internal-api/contractors/api/contractors.api.js +179 -179
- package/src/saas/internal-api/contractors/api/contractors.service.js +247 -234
- package/src/saas/internal-api/contractors/consts/consts.js +6 -6
- package/src/saas/internal-api/contractors/index.js +8 -8
- package/src/saas/internal-api/contractors/models/assign.requirement.model.js +10 -10
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +60 -60
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
- package/src/saas/internal-api/contractors/utils.js +25 -25
- package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
- package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
- package/src/saas/internal-api/dashboard/index.js +5 -5
- package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +147 -147
- package/src/saas/internal-api/dbEmails/consts/consts.js +54 -54
- package/src/saas/internal-api/dbEmails/index.js +6 -6
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +22 -22
- package/src/saas/internal-api/dbEmails/utils/util.js +82 -82
- package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -26
- package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -50
- package/src/saas/internal-api/emailCustomization/index.js +3 -3
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +105 -106
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +60 -60
- package/src/saas/internal-api/globalRecord/utils/util.js +161 -161
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +41 -41
- package/src/saas/internal-api/projects/utils/utils.js +156 -156
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +47 -47
- package/src/saas/internal-api/recordNotes/api/record.notes.utils.js +12 -12
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/reports/api/reports.api.js +39 -39
- package/src/saas/internal-api/reports/api/reports.service.js +34 -34
- package/src/saas/internal-api/reports/consts/consts.js +64 -64
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +96 -90
- package/src/saas/internal-api/requests/api/requests.service.js +220 -208
- package/src/saas/internal-api/requests/index.js +18 -16
- package/src/saas/internal-api/requests/models/create.request.model.js +34 -34
- package/src/saas/internal-api/requests/models/draft.request.report.model.js +14 -14
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
- package/src/saas/internal-api/requests/models/{inner.page.request.criteria.model.js → requestListCriteriaModel.js} +17 -17
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
- package/src/saas/internal-api/requests/utils.js +8 -8
- package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
- package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
- package/src/saas/internal-api/requestsTable/index.js +3 -3
- package/src/saas/internal-api/requirements/api/requirements.api.js +51 -45
- package/src/saas/internal-api/requirements/api/requirements.service.js +153 -142
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +6 -6
- package/src/saas/internal-api/requirements/consts/consts.js +6 -6
- package/src/saas/internal-api/requirements/index.js +10 -10
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
- package/src/saas/internal-api/requirements/models/policy.model.js +33 -33
- package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
- package/src/saas/internal-api/requirements/utils/utils.js +116 -116
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +19 -19
- package/src/saas/internal-api/thread-scheduler/runner.js +39 -39
- package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +31 -31
- package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +42 -42
- package/src/saas/internal-api/uploadFiles/consts.js +12 -12
- package/src/saas/internal-api/uploadFiles/index.js +3 -3
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +32 -32
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +97 -97
- package/src/saas/internal-api/users/api/users.api.js +115 -115
- package/src/saas/internal-api/users/api/users.service.js +203 -203
- package/src/saas/internal-api/users/index.js +16 -16
- package/src/saas/internal-api/users/models/create.inner.system.user.model.js +18 -18
- package/src/saas/internal-api/users/models/notification.settings.model.js +12 -12
- package/src/saas/internal-api/users/models/tenent.user.model.js +11 -11
- package/src/saas/internal-api/users/models/users.model.js +41 -41
- package/src/saas/internal-api/users/utils/util.js +39 -39
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/coi/coi.api.js +20 -20
- package/src/saas/openapi/coi/coi.service.js +13 -13
- package/src/saas/openapi/projects/projects.api.js +83 -83
- package/src/saas/openapi/projects/projects.service.js +64 -64
- package/src/saas/openapi/requests/index.js +7 -7
- package/src/saas/openapi/requests/models/invite.request.model.js +37 -37
- package/src/saas/openapi/requests/models/update.request.model.js +35 -35
- package/src/saas/openapi/requests/requests.api.js +82 -82
- package/src/saas/openapi/requests/requests.service.js +70 -70
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +32 -32
- package/src/saas/openapi/requirements/requirements.service.js +37 -37
- package/src/saas/openapi/tabs/index.js +6 -6
- package/src/saas/openapi/tabs/models/create.tab.model.js +6 -6
- package/src/saas/openapi/tabs/tabs.api.js +27 -27
- package/src/saas/openapi/tabs/tabs.service.js +19 -19
- package/src/saas/openapi/users/user.model.js +10 -10
- package/src/saas/openapi/users/users.api.js +33 -33
- package/src/saas/openapi/users/users.service.js +41 -41
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
- package/src/resources/virusFile.pdf +0 -0
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
const services = require('../api/core/projects.service');
|
|
2
|
-
|
|
3
|
-
const numberUtils = require('../../../../common/utils/numberUtils');
|
|
4
|
-
|
|
5
|
-
const CreateProjectModel = require('../models/core/create.project.model');
|
|
6
|
-
const UpdateProjectModel = require('../models/core/update.project.model');
|
|
7
|
-
|
|
8
|
-
const { NAME: DEFAULT_PROJECT_NAME } = require('../consts/defaultProject');
|
|
9
|
-
|
|
10
|
-
const getDefaultProjectId = async (accountId, context) => {
|
|
11
|
-
const defaultProject = await services.getProjectByName(accountId, DEFAULT_PROJECT_NAME, context);
|
|
12
|
-
return defaultProject ? defaultProject.projectId : null;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const getOrCreateProject = (accountId, projectConfig, context) => {
|
|
16
|
-
const createProjectModel = getCreateProjectModel(accountId, projectConfig);
|
|
17
|
-
return services.getOrCreateProject(createProjectModel, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getCreateProjectModel = (accountId, projectData) => {
|
|
21
|
-
const createProjectModel = new CreateProjectModel(
|
|
22
|
-
accountId,
|
|
23
|
-
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
24
|
-
projectData.description || projectData['Region/Division'] || 'N/A',
|
|
25
|
-
projectData.address || projectData['Address'] || 'N/A',
|
|
26
|
-
projectData.number || projectData['Property Number'] || projectData['Project Number'] || 'N/A',
|
|
27
|
-
projectData.startDate || projectData['Start Date'] || '01/01/2021',
|
|
28
|
-
projectData.endDate || projectData['End Date'] || '01/01/2021',
|
|
29
|
-
projectData.city || projectData['City'] || 'N/A',
|
|
30
|
-
projectData.state || projectData['State'] || 'Alabama',
|
|
31
|
-
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
32
|
-
projectData.companyNameForProject || projectData['Company Name (for external communications)'] || projectData.name
|
|
33
|
-
);
|
|
34
|
-
return createProjectModel;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const getUpdateProjectModel = (accountId, projectId, projectData) => {
|
|
38
|
-
const updateProjectModel = new UpdateProjectModel(
|
|
39
|
-
accountId,
|
|
40
|
-
projectId,
|
|
41
|
-
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
42
|
-
projectData.description || projectData['Region/Division'],
|
|
43
|
-
projectData.address || projectData['Address'],
|
|
44
|
-
projectData.number || projectData['Property Number'] || projectData['Project Number'],
|
|
45
|
-
projectData.startDate || projectData['Start Date'],
|
|
46
|
-
projectData.endDate || projectData['End Date'],
|
|
47
|
-
projectData.city || projectData['City'],
|
|
48
|
-
projectData.state || projectData['State'],
|
|
49
|
-
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
50
|
-
projectData.companyNameForProject || projectData['Company Name (for external communications)']
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
return updateProjectModel;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const getProjectConfig = (projectName, { city, state, accountName, projectNumber } = {}) => {
|
|
57
|
-
return {
|
|
58
|
-
'name': projectName,
|
|
59
|
-
'description': `${projectName}Description`,
|
|
60
|
-
'address': `${projectName}Street 14.`,
|
|
61
|
-
'number': projectNumber || numberUtils.getRandomNumberInRange(10000, 99999),
|
|
62
|
-
'startDate': '01/01/2022',
|
|
63
|
-
'endDate': '01/01/2030',
|
|
64
|
-
'city': city || `${projectName}City`,
|
|
65
|
-
'state': state || 'Alabama',
|
|
66
|
-
'zipCode': '11111',
|
|
67
|
-
'companyNameForProject': accountName || `${projectName}Account`
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const deleteProjectByName = (accountId, projectName, context) => {
|
|
72
|
-
return services.deleteProjectByName(accountId, projectName, context);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const isUIConfig = config => {
|
|
76
|
-
const allKeysSettings = { ... attributesConvertor, ... marketplaceAttributesConvertor, ... autoGapsConvertor, ... autocompleteAttributesConvertor };
|
|
77
|
-
const convectorKeys = Object.keys(allKeysSettings);
|
|
78
|
-
const configKeys = Object.keys(config);
|
|
79
|
-
|
|
80
|
-
return convectorKeys.some(key => configKeys.includes(key));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const assignNewSettingFormat = (target, sourceKey, sourceValue, dictionaryObject) => {
|
|
84
|
-
const attributeKey = dictionaryObject[sourceKey];
|
|
85
|
-
const attributeValue = JSON.parse(sourceValue);
|
|
86
|
-
Object.assign(target, { [attributeKey]: attributeValue });
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const marketplaceParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
90
|
-
settings.marketplaceSettings = settings.marketplaceSettings || {};
|
|
91
|
-
|
|
92
|
-
assignNewSettingFormat(settings.marketplaceSettings, sourceKey, sourceValue, dictionary);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const autoGapsParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
96
|
-
settings.autoGaps = settings.autoGaps || {};
|
|
97
|
-
|
|
98
|
-
assignNewSettingFormat(settings.autoGaps, sourceKey, sourceValue, dictionary);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const autocompleteParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
102
|
-
settings.autocompleteSettings = settings.autocompleteSettings || {};
|
|
103
|
-
|
|
104
|
-
assignNewSettingFormat(settings.autocompleteSettings, sourceKey, sourceValue, dictionary);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const parseProjectSettingsConfig = (projectId, settingsConfig) => {
|
|
108
|
-
const settings = { projectId };
|
|
109
|
-
|
|
110
|
-
for (const setting in settingsConfig) {
|
|
111
|
-
marketplaceAttributesConvertor[setting] && marketplaceParser(settings, setting, settingsConfig[setting], marketplaceAttributesConvertor);
|
|
112
|
-
|
|
113
|
-
autocompleteAttributesConvertor[setting] && autocompleteParser(settings, setting, settingsConfig[setting], autocompleteAttributesConvertor);
|
|
114
|
-
|
|
115
|
-
attributesConvertor[setting] && assignNewSettingFormat(settings, setting, settingsConfig[setting], attributesConvertor);
|
|
116
|
-
|
|
117
|
-
autoGapsConvertor[setting] && autoGapsParser(settings, setting, settingsConfig[setting], autoGapsConvertor);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return settings;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
module.exports = {
|
|
124
|
-
getProjectConfig,
|
|
125
|
-
getOrCreateProject,
|
|
126
|
-
getDefaultProjectId,
|
|
127
|
-
getCreateProjectModel,
|
|
128
|
-
getUpdateProjectModel,
|
|
129
|
-
deleteProjectByName,
|
|
130
|
-
parseProjectSettingsConfig,
|
|
131
|
-
isUIConfig
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const attributesConvertor = {
|
|
135
|
-
'Automatic Renewal': 'autoRenewals',
|
|
136
|
-
'Onboarding Phase Enabled': 'onboardingPhase',
|
|
137
|
-
'Tenant App': 'tenantSolution'
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const marketplaceAttributesConvertor = {
|
|
141
|
-
'Vendor Network Onboarding': 'marketplaceEnabled',
|
|
142
|
-
'Vendor Network - Show Onboarded Vendors': 'marketplaceOnboardedVendors',
|
|
143
|
-
'Pre-Approved Tab': 'marketplacePreApproved',
|
|
144
|
-
'Compliant Vendor Quotation': 'marketplaceCompliantVendorQuotationEnabled'
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const autocompleteAttributesConvertor = {
|
|
148
|
-
'For PM': 'autocompleteAddVendorsForPm',
|
|
149
|
-
'For Tenants': 'autocompleteAddVendorsForTenants'
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const autoGapsConvertor = {
|
|
153
|
-
'Guests': 'isAutoGapsEnabledForGuests',
|
|
154
|
-
'Tenants': 'isAutoGapsEnabledForTenants',
|
|
155
|
-
'Vendors': 'isAutoGapsEnabledForVendors'
|
|
156
|
-
};
|
|
1
|
+
const services = require('../api/core/projects.service');
|
|
2
|
+
|
|
3
|
+
const numberUtils = require('../../../../common/utils/numberUtils');
|
|
4
|
+
|
|
5
|
+
const CreateProjectModel = require('../models/core/create.project.model');
|
|
6
|
+
const UpdateProjectModel = require('../models/core/update.project.model');
|
|
7
|
+
|
|
8
|
+
const { NAME: DEFAULT_PROJECT_NAME } = require('../consts/defaultProject');
|
|
9
|
+
|
|
10
|
+
const getDefaultProjectId = async (accountId, context) => {
|
|
11
|
+
const defaultProject = await services.getProjectByName(accountId, DEFAULT_PROJECT_NAME, context);
|
|
12
|
+
return defaultProject ? defaultProject.projectId : null;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getOrCreateProject = (accountId, projectConfig, context) => {
|
|
16
|
+
const createProjectModel = getCreateProjectModel(accountId, projectConfig);
|
|
17
|
+
return services.getOrCreateProject(createProjectModel, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getCreateProjectModel = (accountId, projectData) => {
|
|
21
|
+
const createProjectModel = new CreateProjectModel(
|
|
22
|
+
accountId,
|
|
23
|
+
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
24
|
+
projectData.description || projectData['Region/Division'] || 'N/A',
|
|
25
|
+
projectData.address || projectData['Address'] || 'N/A',
|
|
26
|
+
projectData.number || projectData['Property Number'] || projectData['Project Number'] || 'N/A',
|
|
27
|
+
projectData.startDate || projectData['Start Date'] || '01/01/2021',
|
|
28
|
+
projectData.endDate || projectData['End Date'] || '01/01/2021',
|
|
29
|
+
projectData.city || projectData['City'] || 'N/A',
|
|
30
|
+
projectData.state || projectData['State'] || 'Alabama',
|
|
31
|
+
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
32
|
+
projectData.companyNameForProject || projectData['Company Name (for external communications)'] || projectData.name
|
|
33
|
+
);
|
|
34
|
+
return createProjectModel;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getUpdateProjectModel = (accountId, projectId, projectData) => {
|
|
38
|
+
const updateProjectModel = new UpdateProjectModel(
|
|
39
|
+
accountId,
|
|
40
|
+
projectId,
|
|
41
|
+
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
42
|
+
projectData.description || projectData['Region/Division'],
|
|
43
|
+
projectData.address || projectData['Address'],
|
|
44
|
+
projectData.number || projectData['Property Number'] || projectData['Project Number'],
|
|
45
|
+
projectData.startDate || projectData['Start Date'],
|
|
46
|
+
projectData.endDate || projectData['End Date'],
|
|
47
|
+
projectData.city || projectData['City'],
|
|
48
|
+
projectData.state || projectData['State'],
|
|
49
|
+
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
50
|
+
projectData.companyNameForProject || projectData['Company Name (for external communications)']
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return updateProjectModel;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const getProjectConfig = (projectName, { city, state, accountName, projectNumber } = {}) => {
|
|
57
|
+
return {
|
|
58
|
+
'name': projectName,
|
|
59
|
+
'description': `${projectName}Description`,
|
|
60
|
+
'address': `${projectName}Street 14.`,
|
|
61
|
+
'number': projectNumber || numberUtils.getRandomNumberInRange(10000, 99999),
|
|
62
|
+
'startDate': '01/01/2022',
|
|
63
|
+
'endDate': '01/01/2030',
|
|
64
|
+
'city': city || `${projectName}City`,
|
|
65
|
+
'state': state || 'Alabama',
|
|
66
|
+
'zipCode': '11111',
|
|
67
|
+
'companyNameForProject': accountName || `${projectName}Account`
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const deleteProjectByName = (accountId, projectName, context) => {
|
|
72
|
+
return services.deleteProjectByName(accountId, projectName, context);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const isUIConfig = config => {
|
|
76
|
+
const allKeysSettings = { ... attributesConvertor, ... marketplaceAttributesConvertor, ... autoGapsConvertor, ... autocompleteAttributesConvertor };
|
|
77
|
+
const convectorKeys = Object.keys(allKeysSettings);
|
|
78
|
+
const configKeys = Object.keys(config);
|
|
79
|
+
|
|
80
|
+
return convectorKeys.some(key => configKeys.includes(key));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const assignNewSettingFormat = (target, sourceKey, sourceValue, dictionaryObject) => {
|
|
84
|
+
const attributeKey = dictionaryObject[sourceKey];
|
|
85
|
+
const attributeValue = JSON.parse(sourceValue);
|
|
86
|
+
Object.assign(target, { [attributeKey]: attributeValue });
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const marketplaceParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
90
|
+
settings.marketplaceSettings = settings.marketplaceSettings || {};
|
|
91
|
+
|
|
92
|
+
assignNewSettingFormat(settings.marketplaceSettings, sourceKey, sourceValue, dictionary);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const autoGapsParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
96
|
+
settings.autoGaps = settings.autoGaps || {};
|
|
97
|
+
|
|
98
|
+
assignNewSettingFormat(settings.autoGaps, sourceKey, sourceValue, dictionary);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const autocompleteParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
102
|
+
settings.autocompleteSettings = settings.autocompleteSettings || {};
|
|
103
|
+
|
|
104
|
+
assignNewSettingFormat(settings.autocompleteSettings, sourceKey, sourceValue, dictionary);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const parseProjectSettingsConfig = (projectId, settingsConfig) => {
|
|
108
|
+
const settings = { projectId };
|
|
109
|
+
|
|
110
|
+
for (const setting in settingsConfig) {
|
|
111
|
+
marketplaceAttributesConvertor[setting] && marketplaceParser(settings, setting, settingsConfig[setting], marketplaceAttributesConvertor);
|
|
112
|
+
|
|
113
|
+
autocompleteAttributesConvertor[setting] && autocompleteParser(settings, setting, settingsConfig[setting], autocompleteAttributesConvertor);
|
|
114
|
+
|
|
115
|
+
attributesConvertor[setting] && assignNewSettingFormat(settings, setting, settingsConfig[setting], attributesConvertor);
|
|
116
|
+
|
|
117
|
+
autoGapsConvertor[setting] && autoGapsParser(settings, setting, settingsConfig[setting], autoGapsConvertor);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return settings;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
module.exports = {
|
|
124
|
+
getProjectConfig,
|
|
125
|
+
getOrCreateProject,
|
|
126
|
+
getDefaultProjectId,
|
|
127
|
+
getCreateProjectModel,
|
|
128
|
+
getUpdateProjectModel,
|
|
129
|
+
deleteProjectByName,
|
|
130
|
+
parseProjectSettingsConfig,
|
|
131
|
+
isUIConfig
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const attributesConvertor = {
|
|
135
|
+
'Automatic Renewal': 'autoRenewals',
|
|
136
|
+
'Onboarding Phase Enabled': 'onboardingPhase',
|
|
137
|
+
'Tenant App': 'tenantSolution'
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const marketplaceAttributesConvertor = {
|
|
141
|
+
'Vendor Network Onboarding': 'marketplaceEnabled',
|
|
142
|
+
'Vendor Network - Show Onboarded Vendors': 'marketplaceOnboardedVendors',
|
|
143
|
+
'Pre-Approved Tab': 'marketplacePreApproved',
|
|
144
|
+
'Compliant Vendor Quotation': 'marketplaceCompliantVendorQuotationEnabled'
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const autocompleteAttributesConvertor = {
|
|
148
|
+
'For PM': 'autocompleteAddVendorsForPm',
|
|
149
|
+
'For Tenants': 'autocompleteAddVendorsForTenants'
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const autoGapsConvertor = {
|
|
153
|
+
'Guests': 'isAutoGapsEnabledForGuests',
|
|
154
|
+
'Tenants': 'isAutoGapsEnabledForTenants',
|
|
155
|
+
'Vendors': 'isAutoGapsEnabledForVendors'
|
|
156
|
+
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
create: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
|
|
6
|
-
getNotesByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
|
|
7
|
-
getNotesCountByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes/count`,
|
|
8
|
-
deleteByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`,
|
|
9
|
-
updateByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const createRecordNote = (recordId, data, context) => {
|
|
13
|
-
return requests.postRequestHandler(Endpoints.create(recordId), data, context);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getNotesByRecordId = (recordId, context) => {
|
|
17
|
-
return requests.getRequestHandler(Endpoints.getNotesByRecordId(recordId), {}, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getNotesCountByRecordId = (recordId, context) => {
|
|
21
|
-
return requests.getRequestHandler(Endpoints.getNotesCountByRecordId(recordId), {}, context);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const deleteByNoteId = (id, data, context) => {
|
|
25
|
-
return requests.deleteRequestHandler(Endpoints.deleteByNoteId(id), context, {}, {}, data);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const updateByNoteId = (id, data, context) => {
|
|
29
|
-
return requests.putRequestHandler(Endpoints.updateByNoteId(id), data, context);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
createRecordNote,
|
|
34
|
-
getNotesByRecordId,
|
|
35
|
-
getNotesCountByRecordId,
|
|
36
|
-
deleteByNoteId,
|
|
37
|
-
updateByNoteId
|
|
38
|
-
};
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
create: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
|
|
6
|
+
getNotesByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
|
|
7
|
+
getNotesCountByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes/count`,
|
|
8
|
+
deleteByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`,
|
|
9
|
+
updateByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const createRecordNote = (recordId, data, context) => {
|
|
13
|
+
return requests.postRequestHandler(Endpoints.create(recordId), data, context);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getNotesByRecordId = (recordId, context) => {
|
|
17
|
+
return requests.getRequestHandler(Endpoints.getNotesByRecordId(recordId), {}, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getNotesCountByRecordId = (recordId, context) => {
|
|
21
|
+
return requests.getRequestHandler(Endpoints.getNotesCountByRecordId(recordId), {}, context);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const deleteByNoteId = (id, data, context) => {
|
|
25
|
+
return requests.deleteRequestHandler(Endpoints.deleteByNoteId(id), context, {}, {}, data);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const updateByNoteId = (id, data, context) => {
|
|
29
|
+
return requests.putRequestHandler(Endpoints.updateByNoteId(id), data, context);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
createRecordNote,
|
|
34
|
+
getNotesByRecordId,
|
|
35
|
+
getNotesCountByRecordId,
|
|
36
|
+
deleteByNoteId,
|
|
37
|
+
updateByNoteId
|
|
38
|
+
};
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
const recordNotesAPI = require('./record.notes.api');
|
|
2
|
-
const utils = require('./record.notes.utils');
|
|
3
|
-
|
|
4
|
-
const createRecordNote = (recordId, data, context, { tagUsers, multipleParagraphs } = {}) => {
|
|
5
|
-
tagUsers && (data.content = utils.getMentionedNoteContent(tagUsers, data.content, { multipleParagraphs }));
|
|
6
|
-
|
|
7
|
-
return recordNotesAPI.createRecordNote(recordId, data, context);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const getNotesByRecordId = (recordId, context) => {
|
|
11
|
-
return recordNotesAPI.getNotesByRecordId(recordId, context);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const getRecordNoteById = async (noteId, recordId, context) => {
|
|
15
|
-
const response = await recordNotesAPI.getNotesByRecordId(recordId, context);
|
|
16
|
-
const notes = response.data;
|
|
17
|
-
const note = notes.find(note => note.id === noteId);
|
|
18
|
-
|
|
19
|
-
if (!note) {
|
|
20
|
-
throw new Error(`Note not found for note id: ${noteId} and record id: ${recordId}`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return note;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const getNotesCountByRecordId = (recordId, context) => {
|
|
27
|
-
return recordNotesAPI.getNotesCountByRecordId(recordId, context);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const deleteByNoteId = (noteId, data, context) => {
|
|
31
|
-
return recordNotesAPI.deleteByNoteId(noteId, data, context);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const updateByNoteId = (noteId, data, context, { tagUsers, multipleParagraphs } = {}) => {
|
|
35
|
-
tagUsers && (data.content = utils.getMentionedNoteContent(tagUsers, data.content, { multipleParagraphs }));
|
|
36
|
-
|
|
37
|
-
return recordNotesAPI.updateByNoteId(noteId, data, context);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
module.exports = {
|
|
41
|
-
createRecordNote,
|
|
42
|
-
getNotesByRecordId,
|
|
43
|
-
getNotesCountByRecordId,
|
|
44
|
-
deleteByNoteId,
|
|
45
|
-
updateByNoteId,
|
|
46
|
-
getRecordNoteById
|
|
47
|
-
};
|
|
1
|
+
const recordNotesAPI = require('./record.notes.api');
|
|
2
|
+
const utils = require('./record.notes.utils');
|
|
3
|
+
|
|
4
|
+
const createRecordNote = (recordId, data, context, { tagUsers, multipleParagraphs } = {}) => {
|
|
5
|
+
tagUsers && (data.content = utils.getMentionedNoteContent(tagUsers, data.content, { multipleParagraphs }));
|
|
6
|
+
|
|
7
|
+
return recordNotesAPI.createRecordNote(recordId, data, context);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const getNotesByRecordId = (recordId, context) => {
|
|
11
|
+
return recordNotesAPI.getNotesByRecordId(recordId, context);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const getRecordNoteById = async (noteId, recordId, context) => {
|
|
15
|
+
const response = await recordNotesAPI.getNotesByRecordId(recordId, context);
|
|
16
|
+
const notes = response.data;
|
|
17
|
+
const note = notes.find(note => note.id === noteId);
|
|
18
|
+
|
|
19
|
+
if (!note) {
|
|
20
|
+
throw new Error(`Note not found for note id: ${noteId} and record id: ${recordId}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return note;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getNotesCountByRecordId = (recordId, context) => {
|
|
27
|
+
return recordNotesAPI.getNotesCountByRecordId(recordId, context);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const deleteByNoteId = (noteId, data, context) => {
|
|
31
|
+
return recordNotesAPI.deleteByNoteId(noteId, data, context);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const updateByNoteId = (noteId, data, context, { tagUsers, multipleParagraphs } = {}) => {
|
|
35
|
+
tagUsers && (data.content = utils.getMentionedNoteContent(tagUsers, data.content, { multipleParagraphs }));
|
|
36
|
+
|
|
37
|
+
return recordNotesAPI.updateByNoteId(noteId, data, context);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
createRecordNote,
|
|
42
|
+
getNotesByRecordId,
|
|
43
|
+
getNotesCountByRecordId,
|
|
44
|
+
deleteByNoteId,
|
|
45
|
+
updateByNoteId,
|
|
46
|
+
getRecordNoteById
|
|
47
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const getMentionedNoteContent = (usersArray, noteContent = '', { multipleParagraphs } = {}) => {
|
|
2
|
-
for (const user of usersArray) {
|
|
3
|
-
const newContent = `<span class="mention" data-full-name="${user.fullName}" data-id="${user.id}" draggable="false"><span contenteditable="false">@${user.fullName}</span></span>`;
|
|
4
|
-
noteContent += multipleParagraphs ? `<p>${newContent}</p>` : newContent;
|
|
5
|
-
}
|
|
6
|
-
noteContent = multipleParagraphs ? noteContent : `<p>${noteContent}</p>`;
|
|
7
|
-
return noteContent;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
getMentionedNoteContent
|
|
12
|
-
};
|
|
1
|
+
const getMentionedNoteContent = (usersArray, noteContent = '', { multipleParagraphs } = {}) => {
|
|
2
|
+
for (const user of usersArray) {
|
|
3
|
+
const newContent = `<span class="mention" data-full-name="${user.fullName}" data-id="${user.id}" draggable="false"><span contenteditable="false">@${user.fullName}</span></span>`;
|
|
4
|
+
noteContent += multipleParagraphs ? `<p>${newContent}</p>` : newContent;
|
|
5
|
+
}
|
|
6
|
+
noteContent = multipleParagraphs ? noteContent : `<p>${noteContent}</p>`;
|
|
7
|
+
return noteContent;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
getMentionedNoteContent
|
|
12
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const services = require('./api/record.notes.service');
|
|
2
|
-
|
|
3
|
-
module.exports = { services };
|
|
1
|
+
const services = require('./api/record.notes.service');
|
|
2
|
+
|
|
3
|
+
module.exports = { services };
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
generateReportAndSendViaEmail: (accountId, reportType) => `${backendUrl}/saas/ExportXLSXReport/account/${accountId}/${reportType}`,
|
|
6
|
-
generateReportAndUploadToS3: reportType => `${backendUrl}/saas/integration-tests/ExportXLSXReport/${reportType}`,
|
|
7
|
-
getScheduledReports: accountId => `${backendUrl}/saas/scheduled-report/account/${accountId}`,
|
|
8
|
-
deleteScheduledReport: scheduledReportId => `${backendUrl}/saas/scheduled-report/${scheduledReportId}`,
|
|
9
|
-
updateScheduledReportLastSentDate: scheduledReportId => `${backendUrl}/saas/automation/scheduled-report/${scheduledReportId}`
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const generateReportAndSendViaEmail = (reportFilters, accountId, reportType, context) => {
|
|
13
|
-
return requests.postRequestHandler(Endpoints.generateReportAndSendViaEmail(accountId, reportType), reportFilters, context);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const generateReportAndUploadToS3 = (reportFilters, reportType, context) => {
|
|
17
|
-
return requests.postRequestHandler(Endpoints.generateReportAndUploadToS3(reportType), reportFilters, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getScheduledReports = (accountId, context) => {
|
|
21
|
-
return requests.getRequestHandler(Endpoints.getScheduledReports(accountId), null, context);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const deleteScheduledReport = (scheduledReportId, context) => {
|
|
25
|
-
return requests.deleteRequestHandler(Endpoints.deleteScheduledReport(scheduledReportId), context);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const updateScheduledReportLastSentDate = (scheduledReportId, customLastSentDate, context) => {
|
|
29
|
-
const url = `${Endpoints.updateScheduledReportLastSentDate(scheduledReportId)}?customLastSentDate=${customLastSentDate.toISOString()}`;
|
|
30
|
-
return requests.putRequestHandler(url, {}, context);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
module.exports = {
|
|
34
|
-
generateReportAndSendViaEmail,
|
|
35
|
-
generateReportAndUploadToS3,
|
|
36
|
-
getScheduledReports,
|
|
37
|
-
deleteScheduledReport,
|
|
38
|
-
updateScheduledReportLastSentDate
|
|
39
|
-
};
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
generateReportAndSendViaEmail: (accountId, reportType) => `${backendUrl}/saas/ExportXLSXReport/account/${accountId}/${reportType}`,
|
|
6
|
+
generateReportAndUploadToS3: reportType => `${backendUrl}/saas/integration-tests/ExportXLSXReport/${reportType}`,
|
|
7
|
+
getScheduledReports: accountId => `${backendUrl}/saas/scheduled-report/account/${accountId}`,
|
|
8
|
+
deleteScheduledReport: scheduledReportId => `${backendUrl}/saas/scheduled-report/${scheduledReportId}`,
|
|
9
|
+
updateScheduledReportLastSentDate: scheduledReportId => `${backendUrl}/saas/automation/scheduled-report/${scheduledReportId}`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const generateReportAndSendViaEmail = (reportFilters, accountId, reportType, context) => {
|
|
13
|
+
return requests.postRequestHandler(Endpoints.generateReportAndSendViaEmail(accountId, reportType), reportFilters, context);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const generateReportAndUploadToS3 = (reportFilters, reportType, context) => {
|
|
17
|
+
return requests.postRequestHandler(Endpoints.generateReportAndUploadToS3(reportType), reportFilters, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getScheduledReports = (accountId, context) => {
|
|
21
|
+
return requests.getRequestHandler(Endpoints.getScheduledReports(accountId), null, context);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const deleteScheduledReport = (scheduledReportId, context) => {
|
|
25
|
+
return requests.deleteRequestHandler(Endpoints.deleteScheduledReport(scheduledReportId), context);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const updateScheduledReportLastSentDate = (scheduledReportId, customLastSentDate, context) => {
|
|
29
|
+
const url = `${Endpoints.updateScheduledReportLastSentDate(scheduledReportId)}?customLastSentDate=${customLastSentDate.toISOString()}`;
|
|
30
|
+
return requests.putRequestHandler(url, {}, context);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
generateReportAndSendViaEmail,
|
|
35
|
+
generateReportAndUploadToS3,
|
|
36
|
+
getScheduledReports,
|
|
37
|
+
deleteScheduledReport,
|
|
38
|
+
updateScheduledReportLastSentDate
|
|
39
|
+
};
|