Skip to content

Commit

Permalink
add server api fxns for updating provenance activity 'used' list
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeddy committed Oct 16, 2019
1 parent 7e00044 commit 3a7426d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions server/api/provenance/provenance.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function getProvenanceGraph(req, res) {
export function getProvenanceGraphByAgent(req, res) {
var agentId = req.params.agentId
var options = {
method: 'GET',
uri: `${config.provenance.apiServerUrl}/activities/byAgent/${agentId}/graph`,
headers: {
'User-Agent': 'Request-Promise'
Expand All @@ -87,6 +88,7 @@ export function getProvenanceGraphByAgent(req, res) {
export function getProvenanceGraphByReference(req, res) {
var referenceId = req.params.referenceId
var options = {
method: 'GET',
uri: `${config.provenance.apiServerUrl}/activities/byReference/${referenceId}/graph`,
headers: {
'User-Agent': 'Request-Promise'
Expand All @@ -111,6 +113,7 @@ export function getProvenanceGraphByReference(req, res) {
export function getProvenanceActivitiesByReference(req, res) {
var referenceId = req.params.referenceId
var options = {
method: 'GET',
uri: `${config.provenance.apiServerUrl}/activities/byReference/${referenceId}`,
headers: {
'User-Agent': 'Request-Promise'
Expand All @@ -131,6 +134,45 @@ export function getProvenanceActivitiesByReference(req, res) {
.catch(handleError(res));
}

// Add 'used' reference entity to a provenance activity
export function addProvenanceActivityUsed(req, res) {
var activityId = req.params.activityId
var options = {
method: 'PUT',
uri: `${config.provenance.apiServerUrl}/activities/${activityId}/used`,
body: req.body,
headers: {
'User-Agent': 'Request-Promise'
},
json: true
};

rp(options)
.then(handleEntityNotFound(res))
.then(respondWithResult(res))
.catch(handleError(res));
}

// Remove 'used' reference entity from a provenance activity
export function removeProvenanceActivityUsed(req, res) {
var activityId = req.params.activityId
var referenceId = req.params.referenceId

var options = {
method: 'DELETE',
uri: `${config.provenance.apiServerUrl}/activities/${activityId}/used/${referenceId}`,
headers: {
'User-Agent': 'Request-Promise'
},
json: true
};

rp(options)
.then(handleEntityNotFound(res))
.then(respondWithResult(res))
.catch(handleError(res));
}

// HELPER FUNCTIONS

export function createActivities(activities) {
Expand Down

0 comments on commit 3a7426d

Please sign in to comment.