| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { Hono } from "hono";
- import {
- createInspectionTemplate,
- getInspectionTemplates,
- updateInspectionTemplate,
- deleteInspectionTemplate,
- createInspectionTask,
- createAutoInspectionTask,
- runManualInspectionTask,
- getInspectionTasks,
- runInspectionTask,
- getInspectionResults,
- exportInspectionReport,
- getInspectionReportReceivers,
- addInspectionReportReceiver,
- removeInspectionReportReceiver,
- createNewYearInspection,
- updateInspectionProgress,
- completeInspection,
- } from "./controllers/inspections.ts";
- import type { Variables, WithAuth } from "./middlewares.ts";
- export function createInspectionsRoutes(withAuth: WithAuth) {
- const router = new Hono<{ Variables: Variables }>()
- router.get("/templates", withAuth, getInspectionTemplates);
- router.post("/templates", withAuth, createInspectionTemplate);
- router.put("/templates/:id", withAuth, updateInspectionTemplate);
- router.delete("/templates/:id", withAuth, deleteInspectionTemplate);
- router.get("/tasks", withAuth, getInspectionTasks);
- router.post("/tasks", withAuth, createInspectionTask);
- router.post("/tasks/auto", withAuth, createAutoInspectionTask);
- router.post("/tasks/manual", withAuth, runManualInspectionTask);
- router.post("/tasks/:id/run", withAuth, runInspectionTask);
- router.get("/results", withAuth, getInspectionResults);
- router.get("/results/:id/export", withAuth, exportInspectionReport);
- router.get("/receivers", withAuth, getInspectionReportReceivers);
- router.post("/receivers", withAuth, addInspectionReportReceiver);
- router.delete("/receivers/:id", withAuth, removeInspectionReportReceiver);
- // 新年巡检相关路由
- router.post("/tasks/new-year", withAuth, createNewYearInspection);
- router.put("/tasks/:id/progress", withAuth, updateInspectionProgress);
- router.post("/tasks/:id/complete", withAuth, completeInspection);
- return router;
- }
|