diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-10 10:24:31 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:48:01 +0200 |
| commit | 3b4e27320c479bd6ef48998f448ed070e8bd7511 (patch) | |
| tree | 35ec6527e8d7a0b4093e18c8cb501c293a18b5eb /frontend/src/api/routes | |
| parent | b30906bbe0d5f343b337a80de1b4b70ebf288331 (diff) | |
| parent | 8aa174e70c01631ae4e00a6d208966fcd77cf972 (diff) | |
Merge pull request #8 from atlarge-research/feature/portfolios-scenarios-frontend
Portfolios and scenarios on the frontend
Diffstat (limited to 'frontend/src/api/routes')
| -rw-r--r-- | frontend/src/api/routes/experiments.js | 26 | ||||
| -rw-r--r-- | frontend/src/api/routes/portfolios.js | 42 | ||||
| -rw-r--r-- | frontend/src/api/routes/projects.js | 16 | ||||
| -rw-r--r-- | frontend/src/api/routes/scenarios.js | 42 |
4 files changed, 84 insertions, 42 deletions
diff --git a/frontend/src/api/routes/experiments.js b/frontend/src/api/routes/experiments.js deleted file mode 100644 index acc72f34..00000000 --- a/frontend/src/api/routes/experiments.js +++ /dev/null @@ -1,26 +0,0 @@ -import { deleteById, getById } from './util' -import { sendRequest } from '../index' - -export function addExperiment(projectId, experiment) { - return sendRequest({ - path: '/projects/{projectId}/experiments', - method: 'POST', - parameters: { - body: { - experiment, - }, - path: { - projectId, - }, - query: {}, - }, - }) -} - -export function getExperiment(experimentId) { - return getById('/experiments/{experimentId}', { experimentId }) -} - -export function deleteExperiment(experimentId) { - return deleteById('/experiments/{experimentId}', { experimentId }) -} diff --git a/frontend/src/api/routes/portfolios.js b/frontend/src/api/routes/portfolios.js new file mode 100644 index 00000000..7c9ea02a --- /dev/null +++ b/frontend/src/api/routes/portfolios.js @@ -0,0 +1,42 @@ +import { deleteById, getById } from './util' +import { sendRequest } from '../index' + +export function addPortfolio(projectId, portfolio) { + return sendRequest({ + path: '/projects/{projectId}/portfolios', + method: 'POST', + parameters: { + body: { + portfolio, + }, + path: { + projectId, + }, + query: {}, + }, + }) +} + +export function getPortfolio(portfolioId) { + return getById('/portfolios/{portfolioId}', { portfolioId }) +} + +export function updatePortfolio(portfolioId, portfolio) { + return sendRequest({ + path: '/portfolios/{projectId}', + method: 'POST', + parameters: { + body: { + portfolio, + }, + path: { + portfolioId, + }, + query: {}, + }, + }) +} + +export function deletePortfolio(portfolioId) { + return deleteById('/portfolios/{portfolioId}', { portfolioId }) +} diff --git a/frontend/src/api/routes/projects.js b/frontend/src/api/routes/projects.js index a261adb8..4109079c 100644 --- a/frontend/src/api/routes/projects.js +++ b/frontend/src/api/routes/projects.js @@ -38,19 +38,3 @@ export function updateProject(project) { export function deleteProject(projectId) { return deleteById('/projects/{projectId}', { projectId }) } - -export function addExperiment(projectId, experiment) { - return sendRequest({ - path: '/projects/{projectId}/experiments', - method: 'POST', - parameters: { - body: { - experiment, - }, - path: { - projectId, - }, - query: {}, - }, - }) -} diff --git a/frontend/src/api/routes/scenarios.js b/frontend/src/api/routes/scenarios.js new file mode 100644 index 00000000..ab2e8b86 --- /dev/null +++ b/frontend/src/api/routes/scenarios.js @@ -0,0 +1,42 @@ +import { deleteById, getById } from './util' +import { sendRequest } from '../index' + +export function addScenario(portfolioId, scenario) { + return sendRequest({ + path: '/portfolios/{portfolioId}/scenarios', + method: 'POST', + parameters: { + body: { + scenario, + }, + path: { + portfolioId, + }, + query: {}, + }, + }) +} + +export function getScenario(scenarioId) { + return getById('/scenarios/{scenarioId}', { scenarioId }) +} + +export function updateScenario(scenarioId, scenario) { + return sendRequest({ + path: '/scenarios/{projectId}', + method: 'POST', + parameters: { + body: { + scenario, + }, + path: { + scenarioId, + }, + query: {}, + }, + }) +} + +export function deleteScenario(scenarioId) { + return deleteById('/scenarios/{scenarioId}', { scenarioId }) +} |
