Recurring event improvements (#2750)

* Loading state and rejected bookings gone

* Listing fixes

* Tweaking upcoming vs recurring bookings tabs

* Tweaking new emails to avoid recurringEvent param

* Tweaks to support recurring events in common flows

* Missed one renderEmail

* Removing uneeded references

* Reverting manual plural fixes

* Refactoring recurring event strings

* Correcting merge issues

* Relying on newly introduced obj

* Fixing mobile

* Final tweaks

* Latest fixes

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2022-06-10 17:38:06 -03:00
1 parent 67a7c578b1
commit 514fca7a53
25 files changed
+999 -510

No files matched your search

+1 -1
View File
@@ -224,7 +224,7 @@ async function patchHandler(req: NextApiRequest) {
}
if (recurringEventId) {
// The booking to confirm is a recurring event and comes from /booking/upcoming, proceeding to mark all related
// The booking to confirm is a recurring event and comes from /booking/recurring, proceeding to mark all related
// bookings as confirmed. Prisma updateMany does not support relations, so doing this in two steps for now.
const unconfirmedRecurringBookings = await prisma.booking.findMany({
where: {
+23 -9
View File
@@ -35,6 +35,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
},
select: {
...bookingMinimalSelect,
recurringEventId: true,
userId: true,
user: {
select: {
@@ -146,15 +147,28 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
// by cancelling first, and blocking whilst doing so; we can ensure a cancel
// action always succeeds even if subsequent integrations fail cancellation.
await prisma.booking.update({
where: {
uid,
},
data: {
status: BookingStatus.CANCELLED,
cancellationReason: cancellationReason,
},
});
if (bookingToDelete.eventType?.recurringEvent) {
// Proceed to mark as cancelled all recurring event instances
await prisma.booking.updateMany({
where: {
recurringEventId: bookingToDelete.recurringEventId,
},
data: {
status: BookingStatus.CANCELLED,
cancellationReason: cancellationReason,
},
});
} else {
await prisma.booking.update({
where: {
uid,
},
data: {
status: BookingStatus.CANCELLED,
cancellationReason: cancellationReason,
},
});
}
/** TODO: Remove this without breaking functionality */
if (bookingToDelete.location === "integrations:daily") {