group.js 910 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const person_ctrl = require('../controllers/person');
  2. const group_ctrl = require('../controllers/group');
  3. module.exports = [
  4. {
  5. url: '/group',
  6. method: 'get',
  7. func: group_ctrl.get_all
  8. },
  9. {
  10. url: '/group',
  11. method: 'post',
  12. func: group_ctrl.create
  13. },
  14. {
  15. url: '/group/:group_id',
  16. method: 'get',
  17. func: group_ctrl.get_by_id
  18. },
  19. {
  20. url: '/group/:group_id',
  21. method: 'put',
  22. func: group_ctrl.update_by_id
  23. },
  24. {
  25. url: '/group/:group_id',
  26. method: 'delete',
  27. func: group_ctrl.delete_by_id
  28. },
  29. {
  30. url: '/person/:person_id/group',
  31. method: 'get',
  32. func: [ person_ctrl.load_by_id, group_ctrl.get_all_of_person ]
  33. },
  34. {
  35. url: '/person/:person_id/group/:group_id',
  36. method: 'post',
  37. func: [ person_ctrl.load_by_id, group_ctrl.add_to_person ]
  38. },
  39. {
  40. url: '/person/:person_id/group/:group_id',
  41. method: 'delete',
  42. func: [ person_ctrl.load_by_id, group_ctrl.remove_from_person ]
  43. }
  44. ];