-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
creating api editMerchantProfile that change email, storeName, phone, and address #58
base: main
Are you sure you want to change the base?
Conversation
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, | ||
}, | ||
}); | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, | |
}, | |
}); | |
}), |
already PRed in other branch, don't push
src/server/api/routers/merchant.ts
Outdated
editMerchantProfile: protectedProcedure | ||
.input( | ||
z.object({ | ||
merchantId: z.string(), | ||
}) | ||
) | ||
.mutation(async ({ input: { merchantId }, ctx }) => { | ||
const merchant = await ctx.prisma.merchant.findUnique({ | ||
where: { | ||
id: merchantId, | ||
}, | ||
}); | ||
const email = merchant?.email; | ||
const storeName = merchant?.name; | ||
const phone = merchant?.phone; | ||
const address = merchant?.address; | ||
await ctx.prisma.merchant.update({ | ||
where: { | ||
id: merchantId, | ||
}, | ||
data: { | ||
email: email, | ||
name: storeName, | ||
phone: phone, | ||
address: address, | ||
}, | ||
}); | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't do anything, check code review of editUserProfile PR
Put on hold due to low priority |
No description provided.