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.
760 B Β· 27 lines
TypeScript
12345678910111213141516171819202122232425262728import { deleteAccount, getUser } from "@openstatus/services/user";
import { toServiceCtx, toTRPCError } from "../service-adapter";import { createTRPCRouter, protectedProcedure } from "../trpc";
export const userRouter = createTRPCRouter({ get: protectedProcedure.query(async ({ ctx }) => { try { return await getUser({ ctx: toServiceCtx(ctx), input: { userId: ctx.user.id }, }); } catch (err) { toTRPCError(err); } }),
deleteAccount: protectedProcedure.mutation(async ({ ctx }) => { try { // `userId` is derived from `ctx.actor` inside the service β no // input needed. await deleteAccount({ ctx: toServiceCtx(ctx) }); } catch (err) { toTRPCError(err); } }),});