import { Hono } from 'hono' import { createWorkOrder, getWorkOrders, getWorkOrderDetail, updateWorkOrder, changeWorkOrderStatus, assignWorkOrder, getWorkOrderSettings, updateWorkOrderSettings, getWorkflowDetails } from "./controllers/workOrders.ts"; import type { Variables, WithAuth } from "./middlewares.ts"; export function createWorkOrderRoutes(withAuth: WithAuth) { const router = new Hono<{ Variables: Variables }>() // 工单基础操作 router.get("/", withAuth, getWorkOrders); router.post("/", withAuth, createWorkOrder); // 工单设置 router.get("/settings", withAuth, getWorkOrderSettings); router.post("/settings", withAuth, updateWorkOrderSettings); // 工单详情操作 router.get("/:id", withAuth, getWorkOrderDetail); router.put("/:id", withAuth, updateWorkOrder); // 工单流程操作 router.post("/:id/status", withAuth, changeWorkOrderStatus); router.post("/:id/assign", withAuth, assignWorkOrder); // 工单流程详情 router.get("/:id/workflow-details", withAuth, getWorkflowDetails); return router; }