From 66b87df17c01061b88849a4a0e866777290e4b7c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 14 Aug 2015 11:26:11 +0100 Subject: [PATCH] added deactivate project endpoint --- .../InactiveData/InactiveProjectController.coffee | 12 ++++++++++++ services/web/app/coffee/router.coffee | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/InactiveData/InactiveProjectController.coffee b/services/web/app/coffee/Features/InactiveData/InactiveProjectController.coffee index b37b43872f..802c56cbdf 100644 --- a/services/web/app/coffee/Features/InactiveData/InactiveProjectController.coffee +++ b/services/web/app/coffee/Features/InactiveData/InactiveProjectController.coffee @@ -1,11 +1,23 @@ InactiveProjectManager = require("./InactiveProjectManager") +logger = require("logger-sharelatex") + module.exports = deactivateOldProjects: (req, res)-> + logger.log "recived request to deactivate old projects" InactiveProjectManager.deactivateOldProjects 10, (err)-> if err? res.sendStatus(500) else res.sendStatus(200) + + deactivateProject: (req, res)-> + project_id = req.params.project_id + logger.log project_id:project_id, "recived request to deactivating project" + InactiveProjectManager.deactivateProject project_id, (err)-> + if err? + res.sendStatus 500 + else + res.sendStatus 200 \ No newline at end of file diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index 4ab506635e..22c1fbfe54 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -136,7 +136,8 @@ module.exports = class Router apiRouter.get '/internal/project/:Project_id/zip', AuthenticationController.httpAuth, ProjectDownloadsController.downloadProject apiRouter.get '/internal/project/:project_id/compile/pdf', AuthenticationController.httpAuth, CompileController.compileAndDownloadPdf - apiRouter.get '/internal/deactivateOldProjects', AuthenticationController.httpAuth, InactiveProjectController.deactivateOldProjects + apiRouter.post '/internal/deactivateOldProjects', AuthenticationController.httpAuth, InactiveProjectController.deactivateOldProjects + apiRouter.post '/internal/project/:project_id/deactivate', AuthenticationController.httpAuth, InactiveProjectController.deactivateProject webRouter.get /^\/internal\/project\/([^\/]*)\/output\/(.*)$/, ((req, res, next) ->