@getjones/test-infra 1.1.3 → 1.1.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 +2 -2
- package/src/env.js +6 -3
- package/src/index.js +2 -1
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.setup.js +11 -5
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -0
- package/src/saas/internal-api/compliance/api/convert/convert.setup.js +11 -0
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +17 -0
- package/src/saas/internal-api/compliance/api/coverage/coverage.setup.js +11 -0
- package/src/saas/internal-api/compliance/index.js +9 -1
- package/src/saas/internal-api/contractors/api/contractors.setup.js +0 -1
- package/src/saas/internal-api/contractors/models/create.contractor.model.js +2 -1
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +47 -5
- package/src/saas/internal-api/projects/api/core/projects.api.js +13 -2
- package/src/saas/internal-api/projects/api/core/projects.setup.js +14 -1
- package/src/saas/internal-api/projects/index.js +2 -1
- package/src/saas/internal-api/projects/models/core/update.project.model.js +27 -0
- package/src/saas/internal-api/tabs/api/tabs.setup.js +4 -2
- package/src/saas/openapi/accounts/accounts.api.js +12 -0
- package/src/saas/openapi/accounts/accounts.setup.js +7 -0
- package/src/saas/openapi/projects/projects.api.js +16 -2
- package/src/saas/openapi/projects/projects.setup.js +11 -1
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getjones/test-infra",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Providing internal and openapi interface",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "mocha \"./tests/**/*.test.js\" --slow 3000 --timeout
|
|
7
|
+
"test": "mocha \"./tests/**/*.test.js\" --slow 3000 --timeout 30000 --exit --inlineDiffs --bail --parallel"
|
|
8
8
|
},
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
package/src/env.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
let privateMembers = {
|
|
2
2
|
backendUrl: null,
|
|
3
3
|
openapiUrl: null,
|
|
4
|
+
nodeBackendUrl: null,
|
|
4
5
|
credentials: null,
|
|
5
6
|
environment: null,
|
|
6
7
|
accountCreationSecret: null,
|
|
7
|
-
threadSchedulerSecret: null
|
|
8
|
+
threadSchedulerSecret: null,
|
|
9
|
+
nodeBackendSecret: null
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
const init = conf => {
|
|
@@ -12,6 +14,7 @@ const init = conf => {
|
|
|
12
14
|
requiredValidation({
|
|
13
15
|
backendUrl: privateMembers.backendUrl,
|
|
14
16
|
openapiUrl: privateMembers.openapiUrl,
|
|
17
|
+
nodeBackendUrl: privateMembers.nodeBackendUrl,
|
|
15
18
|
environment: privateMembers.environment
|
|
16
19
|
});
|
|
17
20
|
};
|
|
@@ -20,12 +23,12 @@ const requiredValidation = object => {
|
|
|
20
23
|
const invalidKeys = [];
|
|
21
24
|
Object.keys(object).forEach(key => {
|
|
22
25
|
if (!object[key]) {
|
|
23
|
-
invalidKeys.push(key);
|
|
26
|
+
invalidKeys.push(` '${key}'`);
|
|
24
27
|
}
|
|
25
28
|
});
|
|
26
29
|
|
|
27
30
|
if (invalidKeys.length > 0) {
|
|
28
|
-
throw `Missing required configuration on your environment variables
|
|
31
|
+
throw Error(`Missing required configuration on your environment variables.\nThe missing env-vars are:${invalidKeys}`);
|
|
29
32
|
}
|
|
30
33
|
};
|
|
31
34
|
|
package/src/index.js
CHANGED
|
@@ -42,11 +42,12 @@ const getInternalAPI = () => {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const getOpenAPI = () => {
|
|
45
|
+
const accounts = require('./saas/openapi/accounts/accounts.setup');
|
|
45
46
|
const tabs = require('./saas/openapi/tabs/tabs.setup');
|
|
46
47
|
const contractors = require('./saas/openapi/contractors/contractors.setup');
|
|
47
48
|
const projects = require('./saas/openapi/projects/projects.setup');
|
|
48
49
|
const requirements = require('./saas/openapi/requirements');
|
|
49
|
-
const openAPI = { tabs, contractors, projects, requirements };
|
|
50
|
+
const openAPI = { accounts, tabs, contractors, projects, requirements };
|
|
50
51
|
return openAPI;
|
|
51
52
|
|
|
52
53
|
};
|
|
@@ -5,8 +5,8 @@ const generateApiKeyValue = accountName => {
|
|
|
5
5
|
return crypto.createHash('sha256').update(accountName).digest('base64');
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const createApiKey = async (accountId, apiKeyValue, context) => {
|
|
9
|
-
const data = { apiKeyValue, accountId };
|
|
8
|
+
const createApiKey = async (accountId, apiKeyValue, context, { apiKeyType = null, apiKeyName = null } = {}) => {
|
|
9
|
+
const data = { apiKeyValue, accountId, apiKeyName, apiKeyType };
|
|
10
10
|
return accountsAPI.createApiKey(data, context);
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -28,11 +28,17 @@ const deleteApiKey = async (apiKeyValue, context) => {
|
|
|
28
28
|
return accountsAPI.deleteApiKey(data, context);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const getOrCreateApiKey = async (accountId, apiKey, context) => {
|
|
32
|
-
|
|
31
|
+
const getOrCreateApiKey = async (accountId, apiKey, context, { apiKeyType = null, apiKeyName = null } = {}) => {
|
|
32
|
+
let existingApiKey = await getApiKeyByAccountId(accountId, context);
|
|
33
|
+
|
|
34
|
+
if (existingApiKey.apiKeyValue) {
|
|
35
|
+
return existingApiKey;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
existingApiKey = await getApiKeyDetails(apiKey, context);
|
|
33
39
|
|
|
34
40
|
if (!existingApiKey.apiKeyValue) {
|
|
35
|
-
return createApiKey(accountId, apiKey, context);
|
|
41
|
+
return createApiKey(accountId, apiKey, context, { apiKeyType, apiKeyName });
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
return existingApiKey;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const requests = require('../../../../openapi/common/requests');
|
|
2
|
+
const { nodeBackendUrl, nodeBackendSecret } = require('../../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
ocrToCoverage: `${nodeBackendUrl}/compliance/convert/ocr-to-coverage`,
|
|
6
|
+
requirement: `${nodeBackendUrl}/compliance/convert/requirement`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const convertOcrToCoverage = async ocrData => {
|
|
10
|
+
return requests.postRequestHandler(Endpoints.ocrToCoverage, nodeBackendSecret, ocrData);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const convertRequirement = async oldRequirement => {
|
|
14
|
+
return requests.postRequestHandler(Endpoints.requirement, nodeBackendSecret, oldRequirement);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports = { convertOcrToCoverage, convertRequirement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const convertApi = require('./convert.api');
|
|
2
|
+
|
|
3
|
+
const convertOcrToCoverage = async ocrData => {
|
|
4
|
+
return convertApi.convertOcrToCoverage(ocrData).then(res => res && res.data);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const convertRequirement = async requirement => {
|
|
8
|
+
return convertApi.convertRequirement(requirement).then(res => res && res.data);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = { convertOcrToCoverage, convertRequirement };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const requests = require('../../../common/requests');
|
|
2
|
+
const { nodeBackendUrl } = require('../../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
saveCoverage: `${nodeBackendUrl}/coverage`,
|
|
6
|
+
getCoverageByCoiId: coiId => `${nodeBackendUrl}/coverage/${coiId}`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const saveCoverage = async (coverage, context) => {
|
|
10
|
+
return requests.postRequestHandler(Endpoints.saveCoverage, coverage, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getCoverageByCoiId = async (coiId, context) => {
|
|
14
|
+
return requests.getRequestHandler(Endpoints.getCoverageByCoiId(coiId), {}, context);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports = { saveCoverage, getCoverageByCoiId };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const coverageApi = require('./coverage.api');
|
|
2
|
+
|
|
3
|
+
const saveCoverage = async (coverage, context) => {
|
|
4
|
+
return coverageApi.saveCoverage(coverage, context);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const getCoverageByCoiId = async (coiId, context) => {
|
|
8
|
+
return coverageApi.getCoverageByCoiId(coiId, context).then(res => res && res.data);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = { saveCoverage, getCoverageByCoiId };
|
|
@@ -4,7 +4,15 @@ const auditServices = require('./api/audit/audit.setup');
|
|
|
4
4
|
const waiveModels = require('./models/waive/waive.model');
|
|
5
5
|
const waiveServices = require('./api/waive/waive.setup');
|
|
6
6
|
|
|
7
|
+
const convertServices = require('./api/convert/convert.setup');
|
|
8
|
+
const coverageServices = require('./api/coverage/coverage.setup');
|
|
9
|
+
|
|
7
10
|
const models = { audit: auditModels, waive: waiveModels };
|
|
8
|
-
const services = {
|
|
11
|
+
const services = {
|
|
12
|
+
audit: auditServices,
|
|
13
|
+
waive: waiveServices,
|
|
14
|
+
convert: convertServices,
|
|
15
|
+
coverage: coverageServices
|
|
16
|
+
};
|
|
9
17
|
|
|
10
18
|
module.exports = { services, models };
|
|
@@ -2,7 +2,6 @@ const contractorsAPI = require('./contractors.api');
|
|
|
2
2
|
const { CreateContractorModel } = require('../models/create.contractor.model');
|
|
3
3
|
const { ContractorModel } = require('../models/edit.contractor.model');
|
|
4
4
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
|
-
const requests = require('../../common/requests');
|
|
6
5
|
|
|
7
6
|
const createContractors = async (createContractorsModel, context) => {
|
|
8
7
|
validateType(createContractorsModel, CreateContractorModel);
|
|
@@ -11,10 +11,11 @@ function CreateContractorModel(requirementId, inviterEmail, vendorsInfo) {
|
|
|
11
11
|
vendorsInfo && validateType(vendorsInfo[0], ContractorInfo);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function ContractorInfo(email, companyName) {
|
|
14
|
+
function ContractorInfo(email, companyName, additionalEmails) {
|
|
15
15
|
this.email = email;
|
|
16
16
|
this.companyName = companyName;
|
|
17
17
|
this.title = email;
|
|
18
|
+
this.additionalEmails = additionalEmails;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
module.exports = { CreateContractorModel, ContractorInfo };
|
|
@@ -1,14 +1,56 @@
|
|
|
1
1
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
2
2
|
|
|
3
|
-
function ContractorModel(contractorId, company, emailAddress, tab,
|
|
3
|
+
function ContractorModel(contractorId, company, emailAddress, tab, additionalDetails ) {
|
|
4
|
+
validateType(tab, VendorTabModel);
|
|
5
|
+
validateType(additionalDetails, ContractorDetailsModel);
|
|
6
|
+
|
|
4
7
|
this.contractorId = contractorId;
|
|
5
8
|
this.company = company;
|
|
6
9
|
this.emailAddress = emailAddress;
|
|
7
10
|
this.tab = tab;
|
|
8
|
-
this.tenantRecord = tenantRecord;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
for (const detail in additionalDetails) {
|
|
13
|
+
if (additionalDetails[detail]){
|
|
14
|
+
this[detail] = additionalDetails[detail];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ContractorDetailsModel({
|
|
21
|
+
additionalEmails = null,
|
|
22
|
+
dba = null,
|
|
23
|
+
firstName = null,
|
|
24
|
+
lastName = null,
|
|
25
|
+
address = null,
|
|
26
|
+
city = null,
|
|
27
|
+
state = null,
|
|
28
|
+
zipCode = null,
|
|
29
|
+
phoneNumber = null,
|
|
30
|
+
agreementNumber = null,
|
|
31
|
+
projectDescription = null,
|
|
32
|
+
startDate = null,
|
|
33
|
+
endDate = null,
|
|
34
|
+
tenantRecord = {}
|
|
35
|
+
} = {}){
|
|
36
|
+
this.additionalEmails = additionalEmails;
|
|
37
|
+
this.dba = dba;
|
|
38
|
+
this.fName = firstName;
|
|
39
|
+
this.lName = lastName;
|
|
40
|
+
this.location = address;
|
|
41
|
+
this.city = city;
|
|
42
|
+
this.state = state;
|
|
43
|
+
this.zipCode = zipCode;
|
|
44
|
+
this.phoneNumber = phoneNumber;
|
|
45
|
+
this.subContractNumber = agreementNumber;
|
|
46
|
+
this.descriptionOfOperations = projectDescription;
|
|
47
|
+
this.startDate = startDate;
|
|
48
|
+
this.endDate = endDate;
|
|
49
|
+
|
|
50
|
+
if (tenantRecord){
|
|
51
|
+
validateType(tenantRecord, TenantRecordModel);
|
|
52
|
+
this.tenantRecord = tenantRecord;
|
|
53
|
+
}
|
|
12
54
|
}
|
|
13
55
|
|
|
14
56
|
function TenantRecordModel(id, companyName, emailAddress) {
|
|
@@ -21,4 +63,4 @@ function VendorTabModel(type){
|
|
|
21
63
|
this.type = type;
|
|
22
64
|
}
|
|
23
65
|
|
|
24
|
-
module.exports = { ContractorModel, TenantRecordModel, VendorTabModel };
|
|
66
|
+
module.exports = { ContractorModel, TenantRecordModel, VendorTabModel, ContractorDetailsModel };
|
|
@@ -4,7 +4,9 @@ const { backendUrl } = require('../../../../../env').getEnv();
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
create: `${backendUrl}/saas/project`,
|
|
6
6
|
delete: projectId => `${backendUrl}/saas/project/${projectId}`,
|
|
7
|
-
getByAccountId: `${backendUrl}/saas/project/list
|
|
7
|
+
getByAccountId: `${backendUrl}/saas/project/list`,
|
|
8
|
+
update: `${backendUrl}/saas/project`,
|
|
9
|
+
getProjectByProjectId: projectId => `${backendUrl}/saas/project/${projectId}`
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
const create = async (project, context) => {
|
|
@@ -16,8 +18,17 @@ const getProjectsByAccountId = async (accountId, context) => {
|
|
|
16
18
|
return requests.getRequestHandler(Endpoints.getByAccountId, params, context).then(res => res.data);
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
const getProjectByProjectId = async (projectId, context) => {
|
|
22
|
+
const params = { };
|
|
23
|
+
return requests.getRequestHandler(Endpoints.getProjectByProjectId(projectId), params, context).then(res => res.data);
|
|
24
|
+
};
|
|
25
|
+
|
|
19
26
|
const deleteProjectById = async (projectId, context) => {
|
|
20
27
|
return requests.deleteRequestHandler(Endpoints.delete(projectId), context);
|
|
21
28
|
};
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
const update = async (project, context) => {
|
|
31
|
+
return requests.postRequestHandler(Endpoints.update, project, context);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = { create, getProjectsByAccountId, deleteProjectById, update, getProjectByProjectId };
|
|
@@ -2,6 +2,7 @@ const projectsApi = require('./projects.api');
|
|
|
2
2
|
const accounts = require('../../../accounts/api/core/accounts.core.setup');
|
|
3
3
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
4
4
|
const CreateProjectModel = require('../../models/core/create.project.model');
|
|
5
|
+
const UpdateProjectModel = require('../../models/core/update.project.model');
|
|
5
6
|
|
|
6
7
|
const getProjectsByAccountName = async (accountName, context) => {
|
|
7
8
|
const accountId = accounts.getAccountId(accountName, context);
|
|
@@ -12,6 +13,10 @@ const getProjectsByAccountId = async (accountId, context) => {
|
|
|
12
13
|
return projectsApi.getProjectsByAccountId(accountId, context);
|
|
13
14
|
};
|
|
14
15
|
|
|
16
|
+
const getProjectByProjectId = async (projectId, context) => {
|
|
17
|
+
return projectsApi.getProjectByProjectId(projectId, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
15
20
|
const getProjectsByName = async (accountId, projectName, context) => {
|
|
16
21
|
const projects = await getProjectsByAccountId(accountId, context);
|
|
17
22
|
const filteredProjects = projects.filter(project => project.projectName === projectName);
|
|
@@ -38,10 +43,18 @@ const getOrCreateProject = async (createProjectModel, context) => {
|
|
|
38
43
|
return createProject(createProjectModel, context);
|
|
39
44
|
};
|
|
40
45
|
|
|
46
|
+
const updateProject = async (updateProjectModel, context) => {
|
|
47
|
+
validateType(updateProjectModel, UpdateProjectModel);
|
|
48
|
+
return projectsApi.update(updateProjectModel, context);
|
|
49
|
+
};
|
|
50
|
+
|
|
41
51
|
module.exports = {
|
|
42
52
|
getProjectsByAccountName,
|
|
43
53
|
getProjectsByAccountId,
|
|
44
54
|
createProject,
|
|
45
55
|
deleteProjectByName,
|
|
46
|
-
getOrCreateProject
|
|
56
|
+
getOrCreateProject,
|
|
57
|
+
updateProject,
|
|
58
|
+
getProjectsByName,
|
|
59
|
+
getProjectByProjectId
|
|
47
60
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const projectService = require('./api/core/projects.setup');
|
|
2
2
|
const projectSettingsService = require('./api/settings/project.settings.setup');
|
|
3
3
|
const CreateProjectModel = require('./models/core/create.project.model');
|
|
4
|
+
const UpdateProjectModel = require('./models/core/update.project.model');
|
|
4
5
|
const UpdateProjectSettingsModel = require('./models/settings/update.project.settings.model');
|
|
5
6
|
|
|
6
|
-
const coreModels = { CreateProjectModel };
|
|
7
|
+
const coreModels = { CreateProjectModel, UpdateProjectModel };
|
|
7
8
|
const settingsModels = { UpdateProjectSettingsModel };
|
|
8
9
|
|
|
9
10
|
const services = {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function UpdateProjectModel(accountId, projectId, name, description, address, number, startDate, endDate,
|
|
2
|
+
city, state, zipCode, companyNameForProject, certificateHolder = '', additionalInsured = '',
|
|
3
|
+
tenantSolutionEnabled = 0, onboardingEnabled = 0, automaticRenewalEnabled = 0) {
|
|
4
|
+
this.projectId = projectId;
|
|
5
|
+
this.projectName = name;
|
|
6
|
+
this.userId = accountId;
|
|
7
|
+
this.projectDescription = description;
|
|
8
|
+
|
|
9
|
+
this.address = address;
|
|
10
|
+
this.projectNumber = number;
|
|
11
|
+
this.projectStartDate = startDate;
|
|
12
|
+
this.projectEndDate = endDate;
|
|
13
|
+
|
|
14
|
+
this.city = city;
|
|
15
|
+
this.state = state;
|
|
16
|
+
this.zipCode = zipCode;
|
|
17
|
+
this.companyNameForProject = companyNameForProject;
|
|
18
|
+
|
|
19
|
+
this.certificateHolder = certificateHolder;
|
|
20
|
+
this.additionalInsured = additionalInsured;
|
|
21
|
+
|
|
22
|
+
this.tenantSolutionEnabled = tenantSolutionEnabled;
|
|
23
|
+
this.onboardingEnabled = onboardingEnabled;
|
|
24
|
+
this.automaticRenewalEnabled = automaticRenewalEnabled;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = UpdateProjectModel;
|
|
@@ -14,9 +14,11 @@ const getTabsByProjectId = async (projectId, context) => {
|
|
|
14
14
|
return tabsAPI.getTabsByProjectId(projectId, context);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const getTabsByName = async (projectId, tabName, context) => {
|
|
17
|
+
const getTabsByName = async (projectId, tabName, context,{ tabType }={}) => {
|
|
18
18
|
const tabs = await tabsAPI.getTabsByProjectId(projectId, context);
|
|
19
|
-
const requestedTab =
|
|
19
|
+
const requestedTab = tabType?
|
|
20
|
+
tabs.find(tab => tab.tabName === tabName && tab.type === tabType):
|
|
21
|
+
tabs.find(tab => tab.tabName === tabName);
|
|
20
22
|
return requestedTab;
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const requests = require('../common/requests');
|
|
2
|
+
const { openapiUrl } = require('../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
getAccountList: `${openapiUrl}/accounts`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const getAccountList = async apiKey => {
|
|
9
|
+
return requests.getRequestHandler(Endpoints.getAccountList, apiKey).then(res => res.data);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports = { getAccountList };
|
|
@@ -6,7 +6,9 @@ const Endpoints = {
|
|
|
6
6
|
getAllProjects: `${openapiUrl}/properties/all`,
|
|
7
7
|
getModifiedProjects: `${openapiUrl}/properties/modified`,
|
|
8
8
|
createProject: `${openapiUrl}/properties`,
|
|
9
|
-
updateProject: projectId => `${openapiUrl}/properties/${projectId}
|
|
9
|
+
updateProject: projectId => `${openapiUrl}/properties/${projectId}`,
|
|
10
|
+
getProjectSettings: projectId => `${openapiUrl}/properties/${projectId}/settings`,
|
|
11
|
+
updateProjectSettings: projectId => `${openapiUrl}/properties/${projectId}/settings`
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
const getProjectsByName = async (apiKey, params) => {
|
|
@@ -29,10 +31,22 @@ const updateProject = async (apiKey, projectId, projectData) => {
|
|
|
29
31
|
return requests.patchRequestHandler(Endpoints.updateProject(projectId), apiKey, projectData).then(res => res.data);
|
|
30
32
|
};
|
|
31
33
|
|
|
34
|
+
const updateProjectSettings = async (apiKey, projectId, projectSettings) => {
|
|
35
|
+
return requests.patchRequestHandler(Endpoints.updateProjectSettings(projectId),
|
|
36
|
+
apiKey, projectSettings).then(res => res.data);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getProjectSettings = async (apiKey, projectId) => {
|
|
40
|
+
return requests.getRequestHandler(Endpoints.getProjectSettings(projectId),
|
|
41
|
+
apiKey).then(res => res.data);
|
|
42
|
+
};
|
|
43
|
+
|
|
32
44
|
module.exports = {
|
|
33
45
|
getProjectsByName,
|
|
34
46
|
getAllProjects,
|
|
35
47
|
getModifiedProjects,
|
|
36
48
|
createProject,
|
|
37
|
-
updateProject
|
|
49
|
+
updateProject,
|
|
50
|
+
updateProjectSettings,
|
|
51
|
+
getProjectSettings
|
|
38
52
|
};
|
|
@@ -20,10 +20,20 @@ const getModifiedProjects = async (apiKey, timestamp) => {
|
|
|
20
20
|
return projectsApi.getModifiedProjects(apiKey, { timestamp });
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
const updateProjectSettings = async (apiKey, projectId, projectSettings) => {
|
|
24
|
+
return projectsApi.updateProjectSettings(apiKey, projectId, projectSettings);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getProjectSettings = async (apiKey, projectId) => {
|
|
28
|
+
return projectsApi.getProjectSettings(apiKey, projectId);
|
|
29
|
+
};
|
|
30
|
+
|
|
23
31
|
module.exports = {
|
|
24
32
|
getProjectsByName,
|
|
25
33
|
createProject,
|
|
26
34
|
updateProject,
|
|
27
35
|
getAllProjects,
|
|
28
|
-
getModifiedProjects
|
|
36
|
+
getModifiedProjects,
|
|
37
|
+
updateProjectSettings,
|
|
38
|
+
getProjectSettings
|
|
29
39
|
};
|