routes_work_orders.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Hono } from 'hono'
  2. import {
  3. createWorkOrder,
  4. getWorkOrders,
  5. getWorkOrderDetail,
  6. updateWorkOrder,
  7. changeWorkOrderStatus,
  8. assignWorkOrder,
  9. getWorkOrderSettings,
  10. updateWorkOrderSettings,
  11. getWorkflowDetails
  12. } from "./controllers/workOrders.ts";
  13. import type { Variables, WithAuth } from "./middlewares.ts";
  14. export function createWorkOrderRoutes(withAuth: WithAuth) {
  15. const router = new Hono<{ Variables: Variables }>()
  16. // 工单基础操作
  17. router.get("/", withAuth, getWorkOrders);
  18. router.post("/", withAuth, createWorkOrder);
  19. // 工单设置
  20. router.get("/settings", withAuth, getWorkOrderSettings);
  21. router.post("/settings", withAuth, updateWorkOrderSettings);
  22. // 工单详情操作
  23. router.get("/:id", withAuth, getWorkOrderDetail);
  24. router.put("/:id", withAuth, updateWorkOrder);
  25. // 工单流程操作
  26. router.post("/:id/status", withAuth, changeWorkOrderStatus);
  27. router.post("/:id/assign", withAuth, assignWorkOrder);
  28. // 工单流程详情
  29. router.get("/:id/workflow-details", withAuth, getWorkflowDetails);
  30. return router;
  31. }