diff --git a/src/pages/app/history/details/[ticketId].tsx b/src/pages/app/history/details/[ticketId].tsx index b1a8852..f877301 100644 --- a/src/pages/app/history/details/[ticketId].tsx +++ b/src/pages/app/history/details/[ticketId].tsx @@ -11,7 +11,7 @@ const TicketDetailsPage: AuthNextPage = () => { -
+
{ + const merchant = await ctx.prisma.merchant.findUnique({ + where: { + id: merchantId, + }, + }); + await ctx.prisma.merchant.update({ + where: { + id: merchantId, + }, + data: { + email: email, + name: storeName, + phone: phone, + address: address, + }, + }); + }), }); diff --git a/src/server/api/routers/user.ts b/src/server/api/routers/user.ts index f917604..69951f7 100644 --- a/src/server/api/routers/user.ts +++ b/src/server/api/routers/user.ts @@ -42,4 +42,32 @@ export const userRouter = createTRPCRouter({ } return user; }), + editUserProfile: protectedProcedure + .input( + z.object({ + userId: z.string(), + }) + ) + .mutation(async ({ input: { userId }, ctx }) => { + const user = await ctx.prisma.user.findUnique({ + where: { + id: userId, + }, + }); + const email = user?.email; + const name = user?.name; + const phone = user?.phone; + const address = user?.address; + await ctx.prisma.user.update({ + where: { + id: userId, + }, + data: { + email: email, + name: name, + phone: phone, + address: address, + }, + }); + }), });