added deactivate project endpoint

This commit is contained in:
Henry Oswald 2015-08-14 11:26:11 +01:00
parent bec9bf5c87
commit 66b87df17c
2 changed files with 14 additions and 1 deletions

View file

@ -1,11 +1,23 @@
InactiveProjectManager = require("./InactiveProjectManager") InactiveProjectManager = require("./InactiveProjectManager")
logger = require("logger-sharelatex")
module.exports = module.exports =
deactivateOldProjects: (req, res)-> deactivateOldProjects: (req, res)->
logger.log "recived request to deactivate old projects"
InactiveProjectManager.deactivateOldProjects 10, (err)-> InactiveProjectManager.deactivateOldProjects 10, (err)->
if err? if err?
res.sendStatus(500) res.sendStatus(500)
else else
res.sendStatus(200) 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

View file

@ -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/zip', AuthenticationController.httpAuth, ProjectDownloadsController.downloadProject
apiRouter.get '/internal/project/:project_id/compile/pdf', AuthenticationController.httpAuth, CompileController.compileAndDownloadPdf 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\/(.*)$/, webRouter.get /^\/internal\/project\/([^\/]*)\/output\/(.*)$/,
((req, res, next) -> ((req, res, next) ->