iconDraftRouter.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. let Router = require('koa-router');
  2. let auth = require('../middleware/auth');
  3. let IconDraftController = require('../controller/iconDraftController');
  4. let iconDraftControllerIns = new IconDraftController();
  5. let router = new Router({
  6. prefix: '/api/icon/draft'
  7. });
  8. /**
  9. * 下载图标
  10. *
  11. */
  12. router.get('/download/:iconId', async (ctx) => {
  13. await iconDraftControllerIns.downloadIcon(ctx);
  14. });
  15. /**
  16. * 我的草稿图标列表
  17. *
  18. */
  19. router.get('/list', auth(), async (ctx) => {
  20. await iconDraftControllerIns.getIconDraftList(ctx);
  21. });
  22. /**
  23. * 添加图标草稿
  24. *
  25. */
  26. router.post('/add', auth(), async (ctx) => {
  27. await iconDraftControllerIns.saveDraftIcon(ctx);
  28. });
  29. /**
  30. * collect to transform to draft
  31. *
  32. */
  33. router.post('/collect', auth(), async (ctx) => {
  34. await iconDraftControllerIns.collectIcon(ctx);
  35. });
  36. /**
  37. * 删除图标草稿
  38. *
  39. */
  40. router.post('/delete', auth(), async (ctx) => {
  41. await iconDraftControllerIns.deleteDraftIcon(ctx);
  42. });
  43. /**
  44. * 更新图标草稿
  45. *
  46. */
  47. router.post('/update', auth(), async (ctx) => {
  48. await iconDraftControllerIns.updateDraftIcon(ctx);
  49. });
  50. /**
  51. * 提交草稿转换成正式字体图标并删除
  52. *
  53. */
  54. router.post('/2icon', auth(), async (ctx) => {
  55. await iconDraftControllerIns.changeDraft2Icon(ctx);
  56. });
  57. module.exports = router;