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.
771 B ยท 22 lines
TypeScript
1234567891011121314151617181920212223import { deleteAccount } from "@openstatus/services/user";
import { toServiceCtx, toTRPCError } from "../service-adapter";import { createTRPCRouter, protectedProcedure } from "../trpc";
export const userRouter = createTRPCRouter({ // The authed middleware already loaded this row; re-selecting it would be // the same query. `undefined` for a soft-deleted user matches `getUser`. get: protectedProcedure.query(({ ctx }) => ctx.user.deletedAt ? undefined : ctx.user, ),
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); } }),});