feat: message.ts service

This commit is contained in:
PrimarchPaul
2025-09-27 15:51:33 -04:00
parent 5634518cd3
commit 74f4e076ce
5 changed files with 111 additions and 7 deletions

View File

@@ -0,0 +1,28 @@
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
});
}
);