Files
concord/concord-server/src/routes/realtime.ts
2025-09-27 15:55:20 -04:00

30 lines
621 B
TypeScript

import { Hono } from "hono";
import { zValidator } from "@hono/zod-validator";
import { describeRoute, resolver } from "hono-openapi";
import {
postMessageToChannel,
deleteMessageFromChannel,
} from "../controller/realtime";
const app = new Hono();
app.post(
"message/",
zValidator({
body: z.object({
content: z.string().min(1).max(500),
}),
}),
async (c) => {
const { instanceId, categoryId, channelId } = c.req.params;
const { content } = c.req.body;
return postMessageToChannel(c.get("io"), {
instanceId,
categoryId,
channelId,
content,
});
},
);