Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
1.0 kB ยท 40 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041import { DeleteChatSessionInput, GetChatSessionInput, deleteChatSession, getChatSession, listChatSessions,} from "@openstatus/services/chat-session";
import { toServiceCtx, toTRPCError } from "../service-adapter";import { createTRPCRouter, protectedProcedure } from "../trpc";
export const chatSessionRouter = createTRPCRouter({ list: protectedProcedure.query(async ({ ctx }) => { try { return await listChatSessions({ ctx: toServiceCtx(ctx) }); } catch (err) { toTRPCError(err); } }),
get: protectedProcedure .input(GetChatSessionInput) .query(async ({ ctx, input }) => { try { return await getChatSession({ ctx: toServiceCtx(ctx), input }); } catch (err) { toTRPCError(err); } }),
delete: protectedProcedure .input(DeleteChatSessionInput) .mutation(async ({ ctx, input }) => { try { await deleteChatSession({ ctx: toServiceCtx(ctx), input }); } catch (err) { toTRPCError(err); } }),});