-
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 editUserProfile that change email, name, phone, and address #57
base: main
Are you sure you want to change the base?
Conversation
editUserProfile: protectedProcedure | ||
.input( | ||
z.object({ | ||
userId: z.string(), |
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.
userId: z.string(), | |
userId: z.string(), | |
name: z.string().optional, | |
// dst |
src/server/api/routers/user.ts
Outdated
userId: z.string(), | ||
}) | ||
) | ||
.mutation(async ({ input: { userId }, ctx }) => { |
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.
.mutation(async ({ input: { userId }, ctx }) => { | |
.mutation(async ({ input: { userId, otherInput }, ctx }) => { |
src/server/api/routers/user.ts
Outdated
const email = user?.email; | ||
const name = user?.name; | ||
const phone = user?.phone; | ||
const address = user?.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.
const email = user?.email; | |
const name = user?.name; | |
const phone = user?.phone; | |
const address = user?.address; |
src/server/api/routers/user.ts
Outdated
const user = await ctx.prisma.user.findUnique({ | ||
where: { | ||
id: userId, | ||
}, | ||
}); |
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.
const user = await ctx.prisma.user.findUnique({ | |
where: { | |
id: userId, | |
}, | |
}); |
src/server/api/routers/user.ts
Outdated
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.
wrap in try catch
Put on hold due to being on low priority |
No description provided.