feat(web): 添加拓扑图页面和相关组件
feat(csms): 添加获取当前连接状态的API feat(csms): 添加获取当前活动OCPP WebSocket连接的接口 deps(web): 添加@xyflow/react依赖
This commit is contained in:
@@ -3,6 +3,7 @@ import { desc, eq, sql } from "drizzle-orm";
|
||||
import dayjs from "dayjs";
|
||||
import { useDrizzle } from "@/lib/db.js";
|
||||
import { chargePoint, connector } from "@/db/schema.js";
|
||||
import { ocppConnections } from "@/ocpp/handler.js";
|
||||
import type { HonoEnv } from "@/types/hono.ts";
|
||||
|
||||
const app = new Hono<HonoEnv>();
|
||||
@@ -102,6 +103,13 @@ app.post("/", async (c) => {
|
||||
return c.json({ ...created, connectors: [] }, 201);
|
||||
});
|
||||
|
||||
/** GET /api/charge-points/connections — list currently active OCPP WebSocket connections */
|
||||
app.get("/connections", (c) => {
|
||||
return c.json({
|
||||
connectedIdentifiers: Array.from(ocppConnections.keys()),
|
||||
});
|
||||
});
|
||||
|
||||
/** GET /api/charge-points/:id — single charge point */
|
||||
app.get("/:id", async (c) => {
|
||||
const db = useDrizzle();
|
||||
|
||||
Reference in New Issue
Block a user