Skip to content

Commit

Permalink
fix: recurring booking idempotency key after cancel (#16414)
Browse files Browse the repository at this point in the history
* fix: recurring booking idempotency key after cancel

* refactor: move logic to updateMany of prisma middleware
  • Loading branch information
supalarry authored and zomars committed Sep 4, 2024
1 parent b596922 commit e0989c3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/prisma/extensions/booking-idempotency-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export function bookingIdempotencyKeyExtension() {
}
return query(args);
},
async updateMany({ args, query }) {
if (args.data.status === BookingStatus.CANCELLED || args.data.status === BookingStatus.REJECTED) {
args.data.idempotencyKey = null;
}
return query(args);
},
},
},
});
Expand Down

0 comments on commit e0989c3

Please sign in to comment.