Files
MorganandGitHub 0af6354954 fix: meeting ended page server component dto (#25318)
* fix: meeting ended page server component dto

* fix: repository function fetching too much
2025-11-21 15:29:53 +00:00

42 lines
1.1 KiB
TypeScript

import type { GetServerSidePropsContext } from "next";
import { BookingRepository } from "@calcom/features/bookings/repositories/BookingRepository";
import { prisma } from "@calcom/prisma";
import { type inferSSRProps } from "@lib/types/inferSSRProps";
export type PageProps = inferSSRProps<typeof getServerSideProps>;
export async function getServerSideProps(context: GetServerSidePropsContext) {
const bookingRepo = new BookingRepository(prisma);
const booking = await bookingRepo.findBookingForMeetingEndedPage({
bookingUid: context.query.uid as string,
});
if (!booking) {
const redirect = {
redirect: {
destination: "/video/no-meeting-found",
permanent: false,
},
} as const;
return redirect;
}
// Booking Object DTO, we should not expose any sensitive data through getServerSideProps + server components
const bookingObj = Object.assign(
{},
{
title: booking.title,
startTime: booking.startTime.toString(),
endTime: booking.endTime.toString(),
}
);
return {
props: {
booking: bookingObj,
},
};
}