2015-08-13 17:40:28 -04:00
|
|
|
InactiveProjectManager = require("./InactiveProjectManager")
|
2015-08-14 06:26:11 -04:00
|
|
|
logger = require("logger-sharelatex")
|
|
|
|
|
2015-08-13 17:40:28 -04:00
|
|
|
|
|
|
|
module.exports =
|
|
|
|
|
|
|
|
deactivateOldProjects: (req, res)->
|
2015-08-14 06:26:11 -04:00
|
|
|
logger.log "recived request to deactivate old projects"
|
2017-09-05 07:33:13 -04:00
|
|
|
numberOfProjectsToArchive = parseInt(req.body.numberOfProjectsToArchive, 10)
|
2015-08-19 06:55:35 -04:00
|
|
|
ageOfProjects = req.body.ageOfProjects
|
2015-08-14 09:11:53 -04:00
|
|
|
InactiveProjectManager.deactivateOldProjects numberOfProjectsToArchive, ageOfProjects, (err, projectsDeactivated)->
|
2015-08-13 17:40:28 -04:00
|
|
|
if err?
|
|
|
|
res.sendStatus(500)
|
|
|
|
else
|
2015-08-14 09:11:53 -04:00
|
|
|
res.send(projectsDeactivated)
|
2015-08-13 17:40:28 -04:00
|
|
|
|
2015-08-14 06:26:11 -04: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
|