From 629630a229ac85f6c2065233a82b474ea4038a2f Mon Sep 17 00:00:00 2001 From: Nathan219 Date: Wed, 5 Jul 2017 15:21:25 -0700 Subject: [PATCH] Switch multi-delete to use param, not body --- lib/routes/docker-compose-cluster.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/routes/docker-compose-cluster.js b/lib/routes/docker-compose-cluster.js index 608924210..bafa4926a 100644 --- a/lib/routes/docker-compose-cluster.js +++ b/lib/routes/docker-compose-cluster.js @@ -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') @@ -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 } @@ -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