Skip to content

Commit

Permalink
fix(api/user): setDefaultAddress query bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mrevanzak committed Nov 29, 2023
1 parent 5cdc285 commit e95c766
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/api/src/router/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export const userRouter = createTRPCRouter({
setDefaultAddress: protectedProcedure
.input(addressIdSchema)
.mutation(async ({ input, ctx }) => {
await ctx.db.update(addresses).set({ default: false });
await ctx.db
.update(addresses)
.set({ default: false })
.where(eq(addresses.userId, ctx.auth.userId));

return await ctx.db
.update(addresses)
Expand Down

0 comments on commit e95c766

Please sign in to comment.