feat: added rescheduled UI to Booking page and Booking Listing page (#20401)

* feat: add rescheduling to UI

- Introduced displaying the original booking information.
- Updated UI components to show rescheduling status and details.

* fix: update link styling in booking single view

- Changed link text size to small for better UI consistency in the booking details section.

* refactor, type fixes

* added missing margin

* added rescheduled under other badges

* optimised getting booking

* updated namings and perf

---------

Co-authored-by: amrit <[email protected]>
This commit is contained in:
Gaurav Vermaandamrit authored and GitHub committed 2025-04-09 15:21:26 -04:00
1 parent 5ae50f8670
commit d3d4a90776
7 files changed
+69 -1

No files matched your search

@@ -24,6 +24,7 @@ const getUserBooking = async (uid: string) => {
userPrimaryEmail: true,
fromReschedule: true,
rescheduled: true,
rescheduledBy: true,
user: {
select: {
id: true,
+12
View File
@@ -138,6 +138,18 @@ export class BookingRepository {
});
}
static async findReschedulerByUid({ uid }: { uid: string }) {
return await prisma.booking.findFirst({
where: {
uid,
},
select: {
rescheduledBy: true,
uid: true,
},
});
}
static async groupByActiveBookingCounts({
users,
eventTypeId,
@@ -132,6 +132,7 @@ export async function getBookings({
email: true,
},
},
fromReschedule: true,
rescheduled: true,
references: true,
isRecorded: true,
@@ -437,8 +438,24 @@ export async function getBookings({
booking.attendees = booking.attendees.filter((attendee) => attendee.email === user.email);
}
let rescheduler = null;
if (booking.fromReschedule) {
const rescheduledBooking = await prisma.booking.findUnique({
where: {
uid: booking.fromReschedule,
},
select: {
rescheduledBy: true,
},
});
if (rescheduledBooking) {
rescheduler = rescheduledBooking.rescheduledBy;
}
}
return {
...booking,
rescheduler,
eventType: {
...booking.eventType,
recurringEvent: parseRecurringEvent(booking.eventType?.recurringEvent),