InactiveProjectController.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* eslint-disable
  2. camelcase,
  3. max-len,
  4. */
  5. // TODO: This file was created by bulk-decaffeinate.
  6. // Fix any style issues and re-enable lint.
  7. /*
  8. * decaffeinate suggestions:
  9. * DS102: Remove unnecessary code created because of implicit returns
  10. * DS207: Consider shorter variations of null checks
  11. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  12. */
  13. const InactiveProjectManager = require('./InactiveProjectManager')
  14. module.exports = {
  15. deactivateOldProjects(req, res) {
  16. const numberOfProjectsToArchive = parseInt(
  17. req.body.numberOfProjectsToArchive,
  18. 10
  19. )
  20. const { ageOfProjects } = req.body
  21. return InactiveProjectManager.deactivateOldProjects(
  22. numberOfProjectsToArchive,
  23. ageOfProjects,
  24. function (err, projectsDeactivated) {
  25. if (err != null) {
  26. return res.sendStatus(500)
  27. } else {
  28. return res.json(projectsDeactivated)
  29. }
  30. }
  31. )
  32. },
  33. deactivateProject(req, res) {
  34. const { project_id } = req.params
  35. return InactiveProjectManager.deactivateProject(project_id, function (err) {
  36. if (err != null) {
  37. return res.sendStatus(500)
  38. } else {
  39. return res.sendStatus(200)
  40. }
  41. })
  42. },
  43. }