No delete of booking on seated events, fix id->uid (#7839)
* No delete of booking on seated events, fix id->uid * Use uid or idpull/7879/head
parent
19bc329377
commit
1cd96d4c25
|
@ -86,7 +86,7 @@ export default function CancelBooking(props: Props) {
|
|||
|
||||
const res = await fetch("/api/cancel", {
|
||||
body: JSON.stringify({
|
||||
id: booking?.id,
|
||||
uid: booking?.uid,
|
||||
cancellationReason: cancellationReason,
|
||||
allRemainingBookings,
|
||||
// @NOTE: very important this shouldn't cancel with number ID use uid instead
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { WebhookTriggerEvents, WorkflowReminder } from "@prisma/client";
|
||||
import type { WebhookTriggerEvents, WorkflowReminder, Prisma } from "@prisma/client";
|
||||
import { BookingStatus, MembershipRole, WorkflowMethods } from "@prisma/client";
|
||||
import type { NextApiRequest } from "next";
|
||||
|
||||
|
@ -266,10 +266,13 @@ async function handler(req: CustomRequest) {
|
|||
|
||||
await Promise.all(integrationsToDelete).then(async () => {
|
||||
if (lastAttendee) {
|
||||
await prisma.booking.delete({
|
||||
await prisma.booking.update({
|
||||
where: {
|
||||
id: bookingToDelete.id,
|
||||
},
|
||||
data: {
|
||||
status: BookingStatus.CANCELLED,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -388,11 +391,11 @@ async function handler(req: CustomRequest) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
const where: Prisma.BookingWhereUniqueInput = uid ? { uid } : { id };
|
||||
|
||||
const updatedBooking = await prisma.booking.update({
|
||||
where: {
|
||||
id,
|
||||
uid,
|
||||
},
|
||||
where,
|
||||
data: {
|
||||
status: BookingStatus.CANCELLED,
|
||||
cancellationReason: cancellationReason,
|
||||
|
|
Loading…
Reference in New Issue