InactiveProjectController.coffee 807 B

12345678910111213141516171819202122232425
  1. InactiveProjectManager = require("./InactiveProjectManager")
  2. logger = require("logger-sharelatex")
  3. module.exports =
  4. deactivateOldProjects: (req, res)->
  5. logger.log "recived request to deactivate old projects"
  6. numberOfProjectsToArchive = parseInt(req.body.numberOfProjectsToArchive, 10)
  7. ageOfProjects = req.body.ageOfProjects
  8. InactiveProjectManager.deactivateOldProjects numberOfProjectsToArchive, ageOfProjects, (err, projectsDeactivated)->
  9. if err?
  10. res.sendStatus(500)
  11. else
  12. res.send(projectsDeactivated)
  13. deactivateProject: (req, res)->
  14. project_id = req.params.project_id
  15. logger.log project_id:project_id, "recived request to deactivating project"
  16. InactiveProjectManager.deactivateProject project_id, (err)->
  17. if err?
  18. res.sendStatus 500
  19. else
  20. res.sendStatus 200