Skip to content

Commit

Permalink
Switch multi-delete to use param, not body
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan219 committed Jul 5, 2017
1 parent ecc23a8 commit 629630a
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions lib/routes/docker-compose-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ const redeploySchema = joi.object({
instanceId: joi.string().required()
}).unknown().required()

const multiDeleteSchema = joi.object({
cluster: joi.object({
id: joi.string().required()
}).required().unknown()
}).unknown().required()

function makeCreateOptsFromBody (sessionUser, body, mainInstanceServiceName) {
const repoFullName = keypather.get(body, 'repo')
const branchName = keypather.get(body, 'branch')
Expand Down Expand Up @@ -239,17 +233,13 @@ function multiCreateRoute (req, res, next) {
}

const multiDeleteRoute = function (req, res, next) {
const clusterId = keypather.get(req, 'body.cluster.id')
const clusterId = keypather.get(req, 'params.id')
const log = logger.child({
method: 'multiDeleteRoute',
clusterId
})
log.info('called')
return joi.validateOrBoomAsync(req.body, multiDeleteSchema)
.tap(() => {
log.trace('delete all clusters')
return ClusterConfigService.deleteAllICC(clusterId)
})
return ClusterConfigService.deleteAllICC(clusterId)
.then(() => {
const message = 'cluster.delete.multi job enqueued'
return { json: { message }, status: 202 }
Expand Down Expand Up @@ -280,7 +270,7 @@ app.post('/docker-compose-cluster/multi', multiCreateRoute)
app.post('/docker-compose-cluster/', postRoute)
app.delete('/docker-compose-cluster/', deleteRoute)
app.post('/docker-compose-cluster/redeploy/', redeployRoute)
app.delete('/docker-compose-cluster/multi/', multiDeleteRoute)
app.delete('/docker-compose-cluster/:id/multi/', multiDeleteRoute)
app.get('/docker-compose-cluster/:id/related', multiFetchRoute)

module.exports = app
Expand Down

0 comments on commit 629630a

Please sign in to comment.