Sfoglia il codice sorgente

added deactivate project endpoint

Henry Oswald 11 anni fa
parent
commit
66b87df17c

+ 12 - 0
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

+ 2 - 1
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) ->