Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 6x 1x 1x | import { z } from "zod";
import { peerNameSchema } from "~app/utils/validation";
import type { PeerId } from "~db/ids";
import { authProcedure } from "~web/handlers/trpc";
export const procedure = authProcedure
.meta({
title: "Change user name",
description: "Updates the display name of the current user's self-peer.",
})
.input(z.strictObject({ name: peerNameSchema }))
.mutation(async ({ input, ctx }) => {
const { database } = ctx;
await database
.updateTable("peers")
.set({ name: input.name })
.where("id", "=", ctx.auth.userId as PeerId)
.executeTakeFirst();
});
|