overleaf/services/web/app/coffee/Features/InactiveData/InactiveProjectController.coffee

25 lines
793 B
CoffeeScript
Raw Normal View History

InactiveProjectManager = require("./InactiveProjectManager")
2015-08-14 10:26:11 +00:00
logger = require("logger-sharelatex")
module.exports =
deactivateOldProjects: (req, res)->
2015-08-14 10:26:11 +00:00
logger.log "recived request to deactivate old projects"
numberOfProjectsToArchive = req.body.numberOfProjectsToArchive
ageOfProjects = req.body.ageOfProjects
InactiveProjectManager.deactivateOldProjects numberOfProjectsToArchive, ageOfProjects, (err, projectsDeactivated)->
if err?
res.sendStatus(500)
else
res.send(projectsDeactivated)
2015-08-14 10:26:11 +00:00
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