@getjones/test-infra 1.3.3 → 1.3.5
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 -2
- package/src/common/utils/numberUtils.js +22 -0
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +2 -2
- package/src/saas/internal-api/accounts/api/settings/settings.setup.js +5 -5
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +3 -1
- package/src/saas/internal-api/contractors/api/contractors.api.js +25 -20
- package/src/saas/internal-api/contractors/api/contractors.setup.js +6 -1
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +14 -2
- package/src/saas/internal-api/globalRecord/api/global.record.setup.js +11 -1
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +2 -0
- package/src/saas/internal-api/globalRecord/utils/util.js +2 -1
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +1 -1
- package/src/saas/internal-api/homepageCharts/api/charts.setup.js +1 -1
- package/src/saas/internal-api/projects/api/core/projects.api.js +7 -7
- package/src/saas/internal-api/projects/api/core/projects.setup.js +7 -6
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +3 -3
- package/src/saas/internal-api/projects/api/settings/project.settings.setup.js +2 -2
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +0 -1
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +6 -8
- package/src/saas/internal-api/recordNotes/api/record.notes.setup.js +5 -5
- package/src/saas/internal-api/reports/api/reports.api.js +2 -2
- package/src/saas/internal-api/reports/api/reports.setup.js +1 -1
- package/src/saas/internal-api/requirements/api/requirements.api.js +7 -9
- package/src/saas/internal-api/requirements/api/requirements.setup.js +3 -3
- package/src/saas/internal-api/tabs/api/tabs.api.js +5 -5
- package/src/saas/internal-api/tabs/api/tabs.setup.js +4 -3
- package/src/saas/internal-api/users/api/users.api.js +13 -17
- package/tests/env.test.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getjones/test-infra",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Providing internal and openapi interface",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"chai": "^4.3.4",
|
|
16
16
|
"dotenv": "^8.2.0",
|
|
17
17
|
"enum": "^3.0.4",
|
|
18
|
-
"http-status-code": "^2.1.0",
|
|
19
18
|
"mocha": "^8.3.2"
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { v4: uuidv4 } = require('uuid');
|
|
2
|
+
|
|
3
|
+
const getRandomNumberInRange = (min, max) => {
|
|
4
|
+
min = Math.ceil(min);
|
|
5
|
+
max = Math.floor(max);
|
|
6
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getCapitalLetterUnicodeValueList = ({ listLength = 26 }) => {
|
|
10
|
+
//This code number represent the letter A
|
|
11
|
+
const firstLetterUnicodeValue = 65;
|
|
12
|
+
//Return list of unicodes values for all alphabet letters.
|
|
13
|
+
//The index value will be in the ranges between 1-26 (The English alphabet has 26 letters)
|
|
14
|
+
//In case listLength will be bigger then 26, index will start the cycle again respectively to the ranges
|
|
15
|
+
return Array.from(Array(listLength)).map((_, index) => (index % 26) + firstLetterUnicodeValue);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const getUniqueNumber = () => {
|
|
19
|
+
return uuidv4();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports = { getRandomNumberInRange, getCapitalLetterUnicodeValueList, getUniqueNumber };
|
|
@@ -6,11 +6,11 @@ const Endpoints = {
|
|
|
6
6
|
edit: accountId => `${backendUrl}/saas/account/${accountId}/settings`
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const getAccountSettings =
|
|
9
|
+
const getAccountSettings = (accountId, context) => {
|
|
10
10
|
return requests.getRequestHandler(Endpoints.get(accountId), {}, context);
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const updateAccountSettings =
|
|
13
|
+
const updateAccountSettings = (updateAccountSettingsModel, context) => {
|
|
14
14
|
const { accountId } = updateAccountSettingsModel;
|
|
15
15
|
return requests.putRequestHandler(Endpoints.edit(accountId), updateAccountSettingsModel, context);
|
|
16
16
|
};
|
|
@@ -2,17 +2,17 @@ const accountsAPI = require('./settings.api');
|
|
|
2
2
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
3
3
|
const UpdateAccountSettingsModel = require('../../models/settings/update.settings.model');
|
|
4
4
|
|
|
5
|
-
const getAccountSettings =
|
|
6
|
-
return accountsAPI.getAccountSettings(accountId, context)
|
|
5
|
+
const getAccountSettings = (accountId, context) => {
|
|
6
|
+
return accountsAPI.getAccountSettings(accountId, context);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const updateAccountSettings =
|
|
9
|
+
const updateAccountSettings = (updateAccountSettingsModel, context) => {
|
|
10
10
|
validateType(updateAccountSettingsModel, UpdateAccountSettingsModel);
|
|
11
11
|
return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const restoreAccountSettings =
|
|
15
|
-
const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId, false, false, false);
|
|
14
|
+
const restoreAccountSettings = (accountId, context) => {
|
|
15
|
+
const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId, false, false, false, false);
|
|
16
16
|
return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -3,12 +3,14 @@ class UpdateAccountSettingsModel {
|
|
|
3
3
|
accountId,
|
|
4
4
|
isMultiPropertyTenants,
|
|
5
5
|
isHighPriority,
|
|
6
|
-
hasAnalyticsDashboard
|
|
6
|
+
hasAnalyticsDashboard,
|
|
7
|
+
isExcludedFromNetwork
|
|
7
8
|
) {
|
|
8
9
|
this.accountId = accountId;
|
|
9
10
|
this.isMultiPropertyTenants = isMultiPropertyTenants;
|
|
10
11
|
this.isHighPriority = isHighPriority;
|
|
11
12
|
this.hasAnalyticsDashboard = hasAnalyticsDashboard;
|
|
13
|
+
this.isExcludedFromNetwork = isExcludedFromNetwork;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -10,59 +10,63 @@ const Endpoints = {
|
|
|
10
10
|
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
11
11
|
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
12
12
|
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
13
|
-
assignMptToProperties: (accountId, tenantId) => `${backendUrl}/saas/account/${accountId}/multi-properties/${tenantId}
|
|
13
|
+
assignMptToProperties: (accountId, tenantId) => `${backendUrl}/saas/account/${accountId}/multi-properties/${tenantId}`,
|
|
14
|
+
searchInAutocomplete: ({ projectId, searchWord }) =>
|
|
15
|
+
`${backendUrl}/saas/contractors/search/audited?&projectId=${projectId}&searchWord=${searchWord}`
|
|
14
16
|
};
|
|
15
17
|
|
|
16
|
-
const createContractor =
|
|
17
|
-
return requests.postRequestHandler(Endpoints.create, createContractorModel, context)
|
|
18
|
+
const createContractor = (createContractorModel, context) => {
|
|
19
|
+
return requests.postRequestHandler(Endpoints.create, createContractorModel, context);
|
|
18
20
|
};
|
|
19
21
|
|
|
20
|
-
const getContractorsByAccountId =
|
|
21
|
-
return requests.getRequestHandler(Endpoints.get, params, context)
|
|
22
|
+
const getContractorsByAccountId = (params, context) => {
|
|
23
|
+
return requests.getRequestHandler(Endpoints.get, params, context);
|
|
22
24
|
};
|
|
23
25
|
|
|
24
|
-
const getContractorById =
|
|
25
|
-
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context)
|
|
26
|
+
const getContractorById = (contractorId, context) => {
|
|
27
|
+
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
const deleteByContractorId =
|
|
30
|
+
const deleteByContractorId = (contractorId, context) => {
|
|
29
31
|
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
const archiveByContractorId =
|
|
34
|
+
const archiveByContractorId = (contractorId, context) => {
|
|
33
35
|
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
const restoreByContractorId =
|
|
38
|
+
const restoreByContractorId = (contractorId, context) => {
|
|
37
39
|
return requests.postRequestHandler(Endpoints.restore(contractorId), {}, context);
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
const editContractor =
|
|
42
|
+
const editContractor = (editContractorModel, context) => {
|
|
41
43
|
const params = { updateInfoUser: 'EditVendor' };
|
|
42
|
-
return requests.postRequestHandler(Endpoints.edit(editContractorModel.contractorId), editContractorModel, context, {}, params)
|
|
44
|
+
return requests.postRequestHandler(Endpoints.edit(editContractorModel.contractorId), editContractorModel, context, {}, params);
|
|
43
45
|
};
|
|
44
46
|
|
|
45
|
-
const updateExpiryDate =
|
|
47
|
+
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
46
48
|
const data = { [policyName]: expiryDate };
|
|
47
49
|
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
48
50
|
};
|
|
49
51
|
|
|
50
|
-
const assignMptToProperties =
|
|
52
|
+
const assignMptToProperties = (assignToMptModel, context) => {
|
|
51
53
|
const params = { updateInfoUser: 'EditVendor' };
|
|
52
|
-
|
|
54
|
+
return requests.postRequestHandler(
|
|
53
55
|
Endpoints.assignMptToProperties(assignToMptModel.accountId, assignToMptModel.tenantId),
|
|
54
56
|
assignToMptModel.properties,
|
|
55
57
|
context,
|
|
56
58
|
{},
|
|
57
59
|
params
|
|
58
60
|
);
|
|
59
|
-
return response;
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
const getContractorsByTabId =
|
|
63
|
+
const getContractorsByTabId = (tabId, context, activityStatus) => {
|
|
63
64
|
const body = { tabId, activityStatus };
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
return requests.postRequestHandler(Endpoints.get, body, context);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const searchInAutocomplete = ({ projectId, searchWord }, context) => {
|
|
69
|
+
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ projectId, searchWord }), {}, context);
|
|
66
70
|
};
|
|
67
71
|
|
|
68
72
|
module.exports = {
|
|
@@ -75,5 +79,6 @@ module.exports = {
|
|
|
75
79
|
editContractor,
|
|
76
80
|
updateExpiryDate,
|
|
77
81
|
assignMptToProperties,
|
|
78
|
-
getContractorsByTabId
|
|
82
|
+
getContractorsByTabId,
|
|
83
|
+
searchInAutocomplete
|
|
79
84
|
};
|
|
@@ -50,6 +50,10 @@ const assignMptToProperties = (assignToMptModel, context) => {
|
|
|
50
50
|
return contractorsAPI.assignMptToProperties(assignToMptModel, context);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
const searchInAutoComplete = ({ projectId, searchWord }, context) => {
|
|
54
|
+
return contractorsAPI.searchInAutocomplete({ projectId, searchWord }, context);
|
|
55
|
+
};
|
|
56
|
+
|
|
53
57
|
module.exports = {
|
|
54
58
|
createContractor,
|
|
55
59
|
getContractorsByAccountId,
|
|
@@ -60,5 +64,6 @@ module.exports = {
|
|
|
60
64
|
editContractor,
|
|
61
65
|
updateExpiryDate,
|
|
62
66
|
getContractorsByTabId,
|
|
63
|
-
assignMptToProperties
|
|
67
|
+
assignMptToProperties,
|
|
68
|
+
searchInAutoComplete
|
|
64
69
|
};
|
|
@@ -10,7 +10,9 @@ const Endpoints = {
|
|
|
10
10
|
getGlobalRecordServiceAreas: `${backendUrl}/saas/global-record/service-areas`,
|
|
11
11
|
deleteGlobalRecord: id => `${nodeBackendUrl}/global-record/id/${id}`,
|
|
12
12
|
updateGlobalRecord: id => `${nodeBackendUrl}/global-record/id/${id}`,
|
|
13
|
-
getRecordProfileDetails: id => `${nodeBackendUrl}/global-record/record-profile/id/${id}
|
|
13
|
+
getRecordProfileDetails: id => `${nodeBackendUrl}/global-record/record-profile/id/${id}`,
|
|
14
|
+
getGlobalRecordByPolicyNumber: policyNumber => `${nodeBackendUrl}/global-record/policyNumber/${policyNumber}`,
|
|
15
|
+
publishGlobalRecord: `${backendUrl}/saas/global-record/publish`
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
const getGlobalRecord = async (id, nodeBackendSecret) => {
|
|
@@ -41,6 +43,14 @@ const getRecordProfileDetails = async (id, context) => {
|
|
|
41
43
|
return cookieAuthRequests.getRequestHandler(Endpoints.getRecordProfileDetails(id), {}, context);
|
|
42
44
|
};
|
|
43
45
|
|
|
46
|
+
const publishGlobalRecord = async (globalRecordDetails, context) => {
|
|
47
|
+
return cookieAuthRequests.putRequestHandler(Endpoints.publishGlobalRecord, globalRecordDetails, context);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const getGlobalRecordByPolicyNumber = async (policyNumber, nodeBackendSecret) => {
|
|
51
|
+
return apiKeyAuthRequests.getRequestHandler(Endpoints.getGlobalRecordByPolicyNumber(policyNumber), nodeBackendSecret);
|
|
52
|
+
};
|
|
53
|
+
|
|
44
54
|
module.exports = {
|
|
45
55
|
createGlobalRecord,
|
|
46
56
|
getGlobalRecord,
|
|
@@ -48,5 +58,7 @@ module.exports = {
|
|
|
48
58
|
getGlobalRecordServiceAreas,
|
|
49
59
|
deleteGlobalRecord,
|
|
50
60
|
updateGlobalRecord,
|
|
51
|
-
getRecordProfileDetails
|
|
61
|
+
getRecordProfileDetails,
|
|
62
|
+
getGlobalRecordByPolicyNumber,
|
|
63
|
+
publishGlobalRecord
|
|
52
64
|
};
|
|
@@ -7,6 +7,10 @@ const getGlobalRecordById = async id => {
|
|
|
7
7
|
return globalRecordAPI.getGlobalRecord(id, nodeBackendSecret);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
const getGlobalRecordByPolicyNumber = async policyNumber => {
|
|
11
|
+
return globalRecordAPI.getGlobalRecordByPolicyNumber(policyNumber, nodeBackendSecret);
|
|
12
|
+
};
|
|
13
|
+
|
|
10
14
|
const createGlobalRecord = async createGlobalRecordModel => {
|
|
11
15
|
validateType(createGlobalRecordModel, CreateGlobalRecordModel);
|
|
12
16
|
return globalRecordAPI.createGlobalRecord(createGlobalRecordModel, nodeBackendSecret);
|
|
@@ -48,6 +52,10 @@ const getRecordProfileDetails = async (id, context) => {
|
|
|
48
52
|
return globalRecordAPI.getRecordProfileDetails(id, context);
|
|
49
53
|
};
|
|
50
54
|
|
|
55
|
+
const publishGlobalRecord = async (globalRecordDetails, context) => {
|
|
56
|
+
return globalRecordAPI.publishGlobalRecord(globalRecordDetails, context);
|
|
57
|
+
};
|
|
58
|
+
|
|
51
59
|
module.exports = {
|
|
52
60
|
createGlobalRecord,
|
|
53
61
|
getGlobalRecordById,
|
|
@@ -58,5 +66,7 @@ module.exports = {
|
|
|
58
66
|
getGlobalRecordServiceAreas,
|
|
59
67
|
deleteGlobalRecord,
|
|
60
68
|
updateGlobalRecord,
|
|
61
|
-
getRecordProfileDetails
|
|
69
|
+
getRecordProfileDetails,
|
|
70
|
+
getGlobalRecordByPolicyNumber,
|
|
71
|
+
publishGlobalRecord
|
|
62
72
|
};
|
|
@@ -6,6 +6,7 @@ class CreateGlobalRecordModel {
|
|
|
6
6
|
numberOfAssociatedRequests,
|
|
7
7
|
numberOfFilledMandatory,
|
|
8
8
|
{
|
|
9
|
+
id,
|
|
9
10
|
recordName,
|
|
10
11
|
additionalContacts,
|
|
11
12
|
brokerEmails,
|
|
@@ -16,6 +17,7 @@ class CreateGlobalRecordModel {
|
|
|
16
17
|
lastPublishUserName
|
|
17
18
|
} = {}
|
|
18
19
|
) {
|
|
20
|
+
this.id = id;
|
|
19
21
|
this.header = header;
|
|
20
22
|
this.recordName = recordName;
|
|
21
23
|
this.additionalContacts = additionalContacts;
|
|
@@ -4,7 +4,7 @@ const globalRecordModels = require('../models/global.record.model');
|
|
|
4
4
|
const { CreateGlobalRecordModel } = globalRecordModels;
|
|
5
5
|
const { createGlobalRecord, getAllGlobalRecordsInPage } = globalRecordServices;
|
|
6
6
|
|
|
7
|
-
const { getCapitalLetterUnicodeValueList, getUniqueNumber } = require('
|
|
7
|
+
const { getCapitalLetterUnicodeValueList, getUniqueNumber } = require('../../../../common/utils/numberUtils');
|
|
8
8
|
|
|
9
9
|
const { SERVICE_AREAS } = require('../consts');
|
|
10
10
|
|
|
@@ -56,6 +56,7 @@ const createGlobalRecordModel = config => {
|
|
|
56
56
|
config.numberOfAssociatedRequests,
|
|
57
57
|
config.numberOfFilledMandatory,
|
|
58
58
|
{
|
|
59
|
+
id: config.id,
|
|
59
60
|
recordName: config.recordName,
|
|
60
61
|
additionalContacts: config.additionalContacts,
|
|
61
62
|
brokerEmails: config.brokerEmails,
|
|
@@ -6,7 +6,7 @@ const Endpoints = {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const getHomePageChartsData = context => {
|
|
9
|
-
return requests.postRequestHandler(Endpoints.getHomePageChartsDataApi(), {}, context)
|
|
9
|
+
return requests.postRequestHandler(Endpoints.getHomePageChartsDataApi(), {}, context);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
module.exports = { getHomePageChartsData };
|
|
@@ -9,25 +9,25 @@ const Endpoints = {
|
|
|
9
9
|
getProjectByProjectId: projectId => `${backendUrl}/saas/project/${projectId}`
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const create =
|
|
12
|
+
const create = (project, context) => {
|
|
13
13
|
return requests.putRequestHandler(Endpoints.create, project, context);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const getProjectsByAccountId =
|
|
16
|
+
const getProjectsByAccountId = (accountId, context) => {
|
|
17
17
|
const params = { userId: accountId };
|
|
18
|
-
return requests.getRequestHandler(Endpoints.getByAccountId, params, context)
|
|
18
|
+
return requests.getRequestHandler(Endpoints.getByAccountId, params, context);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const getProjectByProjectId =
|
|
21
|
+
const getProjectByProjectId = (projectId, context) => {
|
|
22
22
|
const params = { };
|
|
23
|
-
return requests.getRequestHandler(Endpoints.getProjectByProjectId(projectId), params, context)
|
|
23
|
+
return requests.getRequestHandler(Endpoints.getProjectByProjectId(projectId), params, context);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const deleteProjectById =
|
|
26
|
+
const deleteProjectById = (projectId, context) => {
|
|
27
27
|
return requests.deleteRequestHandler(Endpoints.delete(projectId), context);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const update =
|
|
30
|
+
const update = (project, context) => {
|
|
31
31
|
return requests.postRequestHandler(Endpoints.update, project, context);
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -9,16 +9,16 @@ const getProjectsByAccountName = async (accountName, context) => {
|
|
|
9
9
|
return getProjectsByAccountId(accountId, context);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const getProjectsByAccountId =
|
|
12
|
+
const getProjectsByAccountId = (accountId, context) => {
|
|
13
13
|
return projectsApi.getProjectsByAccountId(accountId, context);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const getProjectByProjectId =
|
|
16
|
+
const getProjectByProjectId = (projectId, context) => {
|
|
17
17
|
return projectsApi.getProjectByProjectId(projectId, context);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const getProjectsByName = async (accountId, projectName, context) => {
|
|
21
|
-
const projects = await getProjectsByAccountId(accountId, context);
|
|
21
|
+
const { data: projects } = await getProjectsByAccountId(accountId, context);
|
|
22
22
|
const filteredProjects = projects.filter(project => project.projectName === projectName);
|
|
23
23
|
return filteredProjects;
|
|
24
24
|
};
|
|
@@ -28,7 +28,7 @@ const deleteProjectByName = async (accountId, projectName, context) => {
|
|
|
28
28
|
projects.map(async project => await projectsApi.deleteProjectById(project.projectId, context));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const createProject =
|
|
31
|
+
const createProject = (createProjectModel, context) => {
|
|
32
32
|
validateType(createProjectModel, CreateProjectModel);
|
|
33
33
|
return projectsApi.create(createProjectModel, context);
|
|
34
34
|
};
|
|
@@ -40,10 +40,11 @@ const getOrCreateProject = async (createProjectModel, context) => {
|
|
|
40
40
|
return existingProjects[0];
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
const createResponse = await createProject(createProjectModel, context);
|
|
44
|
+
return createResponse.data;
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
const updateProject =
|
|
47
|
+
const updateProject = (updateProjectModel, context) => {
|
|
47
48
|
validateType(updateProjectModel, UpdateProjectModel);
|
|
48
49
|
return projectsApi.update(updateProjectModel, context);
|
|
49
50
|
};
|
|
@@ -6,12 +6,12 @@ const Endpoints = {
|
|
|
6
6
|
updateByProjectId: projectId => `${backendUrl}/saas/project/${projectId}/settings`
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const getProjectSettingsByProjectId =
|
|
9
|
+
const getProjectSettingsByProjectId = (projectId, context) => {
|
|
10
10
|
const params = { projectId };
|
|
11
|
-
return requests.getRequestHandler(Endpoints.getByProjectId(projectId), params, context)
|
|
11
|
+
return requests.getRequestHandler(Endpoints.getByProjectId(projectId), params, context);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const updateProjectSettingsByProjectId =
|
|
14
|
+
const updateProjectSettingsByProjectId = (settings, context) => {
|
|
15
15
|
return requests.putRequestHandler(Endpoints.updateByProjectId(settings.projectId), settings, context);
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -2,12 +2,12 @@ const { getProjectSettingsByProjectId, updateProjectSettingsByProjectId } = requ
|
|
|
2
2
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
3
3
|
const UpdateProjectSettingsModel = require('../../models/settings/update.project.settings.model');
|
|
4
4
|
|
|
5
|
-
const updateProjectSettings =
|
|
5
|
+
const updateProjectSettings = (updateProjectSettingsModel, context) => {
|
|
6
6
|
validateType(updateProjectSettingsModel, UpdateProjectSettingsModel);
|
|
7
7
|
return updateProjectSettingsByProjectId(updateProjectSettingsModel, context);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const getProjectSettings =
|
|
10
|
+
const getProjectSettings = (projectId, context) => {
|
|
11
11
|
return getProjectSettingsByProjectId(projectId, context);
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -9,25 +9,23 @@ const Endpoints = {
|
|
|
9
9
|
updateByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const createRecordNote =
|
|
12
|
+
const createRecordNote = (recordId, data, context) => {
|
|
13
13
|
return requests.postRequestHandler(Endpoints.create(recordId), data, context);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const getNotesByRecordId =
|
|
16
|
+
const getNotesByRecordId = (recordId, context) => {
|
|
17
17
|
return requests.getRequestHandler(Endpoints.getNotesByRecordId(recordId), {}, context);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const getNotesCountByRecordId =
|
|
20
|
+
const getNotesCountByRecordId = (recordId, context) => {
|
|
21
21
|
return requests.getRequestHandler(Endpoints.getNotesCountByRecordId(recordId), {}, context);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const deleteByNoteId =
|
|
25
|
-
|
|
26
|
-
const params = {};
|
|
27
|
-
return requests.deleteRequestHandler(Endpoints.deleteByNoteId(id), context, headers, params, data);
|
|
24
|
+
const deleteByNoteId = (id, data, context) => {
|
|
25
|
+
return requests.deleteRequestHandler(Endpoints.deleteByNoteId(id), context, {}, {}, data);
|
|
28
26
|
};
|
|
29
27
|
|
|
30
|
-
const updateByNoteId =
|
|
28
|
+
const updateByNoteId = (id, data, context) => {
|
|
31
29
|
return requests.putRequestHandler(Endpoints.updateByNoteId(id), data, context);
|
|
32
30
|
};
|
|
33
31
|
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
const recordNotesAPI = require('./record.notes.api');
|
|
2
2
|
|
|
3
|
-
const createRecordNote =
|
|
3
|
+
const createRecordNote = (recordId, data, context) => {
|
|
4
4
|
return recordNotesAPI.createRecordNote(recordId, data, context);
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
const getNotesByRecordId =
|
|
7
|
+
const getNotesByRecordId = (recordId, context) => {
|
|
8
8
|
return recordNotesAPI.getNotesByRecordId(recordId, context);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const getNotesCountByRecordId =
|
|
11
|
+
const getNotesCountByRecordId = (recordId, context) => {
|
|
12
12
|
return recordNotesAPI.getNotesCountByRecordId(recordId, context);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const deleteByNoteId =
|
|
15
|
+
const deleteByNoteId = (noteId, data, context) => {
|
|
16
16
|
return recordNotesAPI.deleteByNoteId(noteId, data, context);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const updateByNoteId =
|
|
19
|
+
const updateByNoteId = (noteId, data, context) => {
|
|
20
20
|
return recordNotesAPI.updateByNoteId(noteId, data, context);
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -5,8 +5,8 @@ const Endpoints = {
|
|
|
5
5
|
generateReport: reportType => `${backendUrl}/saas/integration-tests/ExportXLSXReport/${reportType}`
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const generateReport =
|
|
9
|
-
return requests.postRequestHandler(Endpoints.generateReport(reportType), reportFilters, context)
|
|
8
|
+
const generateReport = (reportFilters, reportType, context) => {
|
|
9
|
+
return requests.postRequestHandler(Endpoints.generateReport(reportType), reportFilters, context);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
module.exports = { generateReport };
|
|
@@ -2,7 +2,7 @@ const reportsApi = require('./reports.api');
|
|
|
2
2
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
3
3
|
const { ReportFilters } = require('../models/report.model');
|
|
4
4
|
|
|
5
|
-
const generateReport =
|
|
5
|
+
const generateReport = (reportFilters, reportType, context) => {
|
|
6
6
|
validateType(reportFilters, ReportFilters);
|
|
7
7
|
return reportsApi.generateReport(reportFilters, reportType, context);
|
|
8
8
|
};
|
|
@@ -8,21 +8,19 @@ const Endpoints = {
|
|
|
8
8
|
delete: requirementId => `${backendUrl}/saas/requirement/${requirementId}`
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const createRequirement =
|
|
12
|
-
return requests.postRequestHandler(Endpoints.create, createRequirementModel, context, {}, params)
|
|
13
|
-
res => res.data
|
|
14
|
-
);
|
|
11
|
+
const createRequirement = (createRequirementModel, context, params) => {
|
|
12
|
+
return requests.postRequestHandler(Endpoints.create, createRequirementModel, context, {}, params);
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
const getRequirementsByTabId =
|
|
18
|
-
return requests.getRequestHandler(Endpoints.getRequirementsByTabId, { tabId }, context)
|
|
15
|
+
const getRequirementsByTabId = (tabId, context) => {
|
|
16
|
+
return requests.getRequestHandler(Endpoints.getRequirementsByTabId, { tabId }, context);
|
|
19
17
|
};
|
|
20
18
|
|
|
21
|
-
const getRequirementById =
|
|
22
|
-
return requests.getRequestHandler(Endpoints.getRequirementById(requirementId), {}, context)
|
|
19
|
+
const getRequirementById = (requirementId, context) => {
|
|
20
|
+
return requests.getRequestHandler(Endpoints.getRequirementById(requirementId), {}, context);
|
|
23
21
|
};
|
|
24
22
|
|
|
25
|
-
const deleteByRequirementId =
|
|
23
|
+
const deleteByRequirementId = (requirementId, context) => {
|
|
26
24
|
return requests.deleteRequestHandler(Endpoints.delete(requirementId), context);
|
|
27
25
|
};
|
|
28
26
|
|
|
@@ -2,17 +2,17 @@ const requirementsAPI = require('./requirements.api');
|
|
|
2
2
|
const { CreateRequirementModel } = require('../models/create.requirement.model');
|
|
3
3
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
4
4
|
|
|
5
|
-
const createRequirement =
|
|
5
|
+
const createRequirement = (createRequirementModel, context) => {
|
|
6
6
|
validateType(createRequirementModel, CreateRequirementModel);
|
|
7
7
|
const params = { 'leaseId': '' };
|
|
8
8
|
return requirementsAPI.createRequirement(createRequirementModel, context, params);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const getRequirementsByTabId =
|
|
11
|
+
const getRequirementsByTabId = (tabId, context) => {
|
|
12
12
|
return requirementsAPI.getRequirementsByTabId(tabId, context);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const getRequirementById =
|
|
15
|
+
const getRequirementById = (requirementId, context) => {
|
|
16
16
|
return requirementsAPI.getRequirementById(requirementId, context);
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -8,19 +8,19 @@ const Endpoints = {
|
|
|
8
8
|
delete: `${backendUrl}/saas/vendortab`
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const getTabsByProjectId =
|
|
12
|
-
return requests.getRequestHandler(Endpoints.getTabsByProjectId, { projectId }, context)
|
|
11
|
+
const getTabsByProjectId = (projectId, context) => {
|
|
12
|
+
return requests.getRequestHandler(Endpoints.getTabsByProjectId, { projectId }, context);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const createTab =
|
|
15
|
+
const createTab = (tabModel, context) => {
|
|
16
16
|
return requests.postRequestHandler(Endpoints.create, tabModel, context);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const updateTab =
|
|
19
|
+
const updateTab = (tabModel, context) => {
|
|
20
20
|
return requests.postRequestHandler(Endpoints.update, tabModel, context);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const deleteTab =
|
|
23
|
+
const deleteTab = (tabId, context) => {
|
|
24
24
|
return requests.deleteRequestHandler(Endpoints.delete, context, {}, { tabId });
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -15,7 +15,7 @@ const getTabsByProjectId = async (projectId, context) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const getTabsByName = async (projectId, tabName, context, { tabType } = {}) => {
|
|
18
|
-
const tabs = await tabsAPI.getTabsByProjectId(projectId, context);
|
|
18
|
+
const { data: tabs } = await tabsAPI.getTabsByProjectId(projectId, context);
|
|
19
19
|
const requestedTab = tabType ?
|
|
20
20
|
tabs.find(tab => tab.tabName === tabName && tab.type === tabType) :
|
|
21
21
|
tabs.find(tab => tab.tabName === tabName);
|
|
@@ -27,14 +27,15 @@ const deleteTabById = async (tabId, context) => {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const getOrCreateTab = async (projectId, tabName, tabType, context) => {
|
|
30
|
-
const tabs = await getTabsByProjectId(projectId, context);
|
|
30
|
+
const { data: tabs } = await getTabsByProjectId(projectId, context);
|
|
31
31
|
const existingTab = tabs.find(tab => tab.tabName === tabName && tab.type === tabType);
|
|
32
32
|
|
|
33
33
|
if (existingTab) {
|
|
34
34
|
return existingTab;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
const createResponse = await createTab(projectId, tabName, tabType, context);
|
|
38
|
+
return createResponse.data;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
module.exports = {
|
|
@@ -13,43 +13,39 @@ const Endpoints = {
|
|
|
13
13
|
reinvite: `${backendUrl}/saas/project/team-member/reinvite`
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const invite =
|
|
17
|
-
const headers = {};
|
|
16
|
+
const invite = (invitedUser, context) => {
|
|
18
17
|
const params = { disableSendMail: true };
|
|
19
|
-
return requests.putRequestHandler(Endpoints.invite, invitedUser, context,
|
|
18
|
+
return requests.putRequestHandler(Endpoints.invite, invitedUser, context, {}, params);
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
const editUserRole =
|
|
21
|
+
const editUserRole = (userId, data, context) => {
|
|
23
22
|
return requests.patchRequestHandler(Endpoints.editUserRole(userId), context, data);
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
const editUserProjects =
|
|
27
|
-
const headers = {};
|
|
25
|
+
const editUserProjects = (data, context) => {
|
|
28
26
|
const params = { disableSendMail: true };
|
|
29
|
-
return requests.putRequestHandler(Endpoints.editUserProjects, data, context,
|
|
27
|
+
return requests.putRequestHandler(Endpoints.editUserProjects, data, context, {}, params);
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
const getUsersByProjectId =
|
|
33
|
-
return requests.getRequestHandler(Endpoints.getByProjectId(projectId), null, context)
|
|
30
|
+
const getUsersByProjectId = (projectId, context) => {
|
|
31
|
+
return requests.getRequestHandler(Endpoints.getByProjectId(projectId), null, context);
|
|
34
32
|
};
|
|
35
33
|
|
|
36
|
-
const getUserByEmail =
|
|
37
|
-
return requests.getRequestHandler(Endpoints.getByEmail(email), null, context)
|
|
34
|
+
const getUserByEmail = (email, context) => {
|
|
35
|
+
return requests.getRequestHandler(Endpoints.getByEmail(email), null, context);
|
|
38
36
|
};
|
|
39
37
|
|
|
40
|
-
const deleteUser =
|
|
38
|
+
const deleteUser = (userId, context) => {
|
|
41
39
|
return requests.deleteRequestHandler(Endpoints.delete(userId), context);
|
|
42
40
|
};
|
|
43
41
|
|
|
44
|
-
const deleteUserFromSingleProject =
|
|
42
|
+
const deleteUserFromSingleProject = (userId, projectId, context) => {
|
|
45
43
|
return requests.deleteRequestHandler(Endpoints.deleteSingleProject(userId, projectId), context);
|
|
46
44
|
};
|
|
47
45
|
|
|
48
|
-
const reinviteUser =
|
|
49
|
-
const body = {};
|
|
50
|
-
const headers = {};
|
|
46
|
+
const reinviteUser = (userId, context) => {
|
|
51
47
|
const params = { id: userId };
|
|
52
|
-
return requests.postRequestHandler(Endpoints.reinvite,
|
|
48
|
+
return requests.postRequestHandler(Endpoints.reinvite, {}, context, {}, params);
|
|
53
49
|
};
|
|
54
50
|
|
|
55
51
|
module.exports = { invite, getUsersByProjectId, getUserByEmail, deleteUser, deleteUserFromSingleProject, editUserRole, editUserProjects, reinviteUser };
|
package/tests/env.test.js
CHANGED
|
@@ -35,6 +35,6 @@ describe('Env | Test Core Logic', async function() {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const envVariables = env.getEnv();
|
|
38
|
-
expect(envVariables).to.
|
|
38
|
+
expect(envVariables).to.eql(expectedSanityAssignVariables, 'Assign configuration did not work properly');
|
|
39
39
|
});
|
|
40
40
|
});
|