feat: soft delete rescheduled booking (#7970)
* feat: add rescheduled status * feat: add new reservation status * fix: add rescheduled to trpc procedure * feat: use soft delete * feat: add new i18n key * feat: add data display for rescheduled booking * chore: fix comment * Revert "feat: add new i18n key" This reverts commit 4cecc00bd3351af6fbdff05d728c438f68fbfc4e. * Revert "feat: add data display for rescheduled booking" This reverts commit 81b4f7e1ab24763f630428b6c338926cf1958be0. * Revert "fix: add rescheduled to trpc procedure" This reverts commit 82b26582d2188e2b18f2f733760c741e7127b1d2. * Revert "feat: add new reservation status" This reverts commit b1dafab774d566dfcbe1c979035a89c729150d59. * Revert "feat: add rescheduled status" This reverts commit c8f24aec0e054b6be7186a631eee2b8a36ced40f. * fix: use cancelled * fix: e2e * fix: e2e * fix: e2e
This commit is contained in:
1 parent
ab7ecff580
commit
9fe912c392
3 files changed
+25
-10
No files matched your search
@@ -205,7 +205,7 @@ test.describe("Booking with Seats", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(oldBooking?.attendees).toBeFalsy();
|
||||
expect(oldBooking?.status).toBe(BookingStatus.CANCELLED);
|
||||
});
|
||||
|
||||
test("Should cancel with seats and have no attendees and cancelled", async ({
|
||||
|
||||
@@ -97,13 +97,19 @@ test.describe("Reschedule Tests", async () => {
|
||||
|
||||
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||
|
||||
const newBooking = await prisma.booking.findFirst({ where: { fromReschedule: booking.uid } });
|
||||
const rescheduledBooking = await prisma.booking.findFirst({ where: { uid: booking.uid } });
|
||||
const newBooking = await prisma.booking.findFirstOrThrow({ where: { fromReschedule: booking.uid } });
|
||||
const rescheduledBooking = await prisma.booking.findFirstOrThrow({ where: { uid: booking.uid } });
|
||||
|
||||
expect(newBooking).not.toBeNull();
|
||||
expect(rescheduledBooking).toBeNull();
|
||||
expect(rescheduledBooking.status).toBe(BookingStatus.CANCELLED);
|
||||
|
||||
await prisma.booking.delete({ where: { id: newBooking?.id } });
|
||||
await prisma.booking.deleteMany({
|
||||
where: {
|
||||
id: {
|
||||
in: [newBooking.id, rescheduledBooking.id],
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("Unpaid rescheduling should go to payment page", async ({ page, users, bookings, payments }) => {
|
||||
|
||||
@@ -895,10 +895,13 @@ async function handler(
|
||||
}
|
||||
|
||||
await Promise.all(integrationsToDelete).then(async () => {
|
||||
await prisma.booking.delete({
|
||||
await prisma.booking.update({
|
||||
where: {
|
||||
id: originalRescheduledBooking.id,
|
||||
},
|
||||
data: {
|
||||
status: BookingStatus.CANCELLED,
|
||||
},
|
||||
});
|
||||
});
|
||||
deletedReferences = true;
|
||||
@@ -1189,11 +1192,14 @@ async function handler(
|
||||
cancellationReason: "$RCH$" + rescheduleReason ? rescheduleReason : "", // Removable code prefix to differentiate cancellation from rescheduling for email
|
||||
});
|
||||
|
||||
// Delete the old booking
|
||||
await prisma.booking.delete({
|
||||
// Update the old booking with the cancelled status
|
||||
await prisma.booking.update({
|
||||
where: {
|
||||
id: booking.id,
|
||||
},
|
||||
data: {
|
||||
status: BookingStatus.CANCELLED,
|
||||
},
|
||||
});
|
||||
|
||||
const resultBooking = await resultBookingQuery(newTimeSlotBooking.id);
|
||||
@@ -1680,12 +1686,15 @@ async function handler(
|
||||
addVideoCallDataToEvt(originalRescheduledBooking.references);
|
||||
const updateManager = await eventManager.reschedule(evt, originalRescheduledBooking.uid);
|
||||
|
||||
//delete original rescheduled booking (no seats event)
|
||||
//update original rescheduled booking (no seats event)
|
||||
if (!eventType.seatsPerTimeSlot) {
|
||||
await prisma.booking.delete({
|
||||
await prisma.booking.update({
|
||||
where: {
|
||||
id: originalRescheduledBooking.id,
|
||||
},
|
||||
data: {
|
||||
status: BookingStatus.CANCELLED,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user