Files
cal.diy/packages/features/bookings/lib/getUserBooking.ts
T
Gaurav Vermaandamrit d3d4a90776 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 <iamamrit27@gmail.com>
2025-04-09 15:21:26 -04:00

67 lines
1.3 KiB
TypeScript

import prisma from "@calcom/prisma";
const getUserBooking = async (uid: string) => {
const bookingInfo = await prisma.booking.findFirst({
where: {
uid: uid,
},
select: {
title: true,
id: true,
uid: true,
description: true,
customInputs: true,
smsReminderNumber: true,
recurringEventId: true,
startTime: true,
endTime: true,
location: true,
status: true,
metadata: true,
cancellationReason: true,
responses: true,
rejectionReason: true,
userPrimaryEmail: true,
fromReschedule: true,
rescheduled: true,
rescheduledBy: true,
user: {
select: {
id: true,
name: true,
email: true,
username: true,
timeZone: true,
avatarUrl: true,
},
},
attendees: {
select: {
name: true,
email: true,
timeZone: true,
phoneNumber: true,
},
},
eventTypeId: true,
eventType: {
select: {
eventName: true,
slug: true,
timeZone: true,
schedulingType: true,
},
},
seatsReferences: {
select: {
referenceUid: true,
},
},
},
});
return bookingInfo;
};
export default getUserBooking;