InactiveProjectController.mjs 1.2 KB

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