/
MariaTsys
/
courseworkPP
Обзор
Документация
Войти
/
MariaTsys
/
courseworkPP
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/server/api/routers/user.ts
26 строк
697 B
Maria
first_commit
09 май 2025, 12:17
09 май 2025, 12:17
af55308
Код
Авторство
О чём код?
import { z } from "zod"; import { createTRPCRouter, protectedProcedure } from "~/server/api/trpc"; export const userRouter = createTRPCRouter({ completeProfile: protectedProcedure .input( z.object({ firstName: z.string().min(1, "Имя обязательно"), lastName: z.string().min(1, "Фамилия обязательна"), }) ) .mutation(async ({ ctx, input }) => { const userId = ctx.session.user.id; const fullName = `${input.firstName} ${input.lastName}`; await ctx.db.user.update({ where: { id: userId }, data: { name: fullName, }, }); return { success: true }; }), });