Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joshuawenata
Copy link
Collaborator

No description provided.

@joshuawenata joshuawenata linked an issue May 20, 2023 that may be closed by this pull request
Comment on lines +45 to +72
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,
},
});
}),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment on lines 43 to 70
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,
},
});
}),
Copy link
Owner

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

@notwatermango notwatermango added the backend Apply backend logic label May 20, 2023
@notwatermango notwatermango added the low priority Not urgent label May 20, 2023
@notwatermango
Copy link
Owner

Put on hold due to low priority
Same reason as #57 not handling optional input

@ttarreuu ttarreuu self-assigned this Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Apply backend logic low priority Not urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api edit merchant profile
3 participants