mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* fix: meeting ended page server component dto * fix: repository function fetching too much
42 lines
1.1 KiB
TypeScript
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,
|
|
},
|
|
};
|
|
}
|