chore: Remove passing optional prisma select prop to Repository classes (#16600)
This commit is contained in:
1 parent
4a59841b02
commit
55e1e0fa3d
7 files changed
+81
-61
No files matched your search
@@ -43,12 +43,8 @@ const Page = async ({ params }: PageProps) => {
|
||||
let userData, schedule, travelSchedules;
|
||||
|
||||
try {
|
||||
userData = await UserRepository.findById({
|
||||
id: userId,
|
||||
select: {
|
||||
timeZone: true,
|
||||
defaultScheduleId: true,
|
||||
},
|
||||
userData = await UserRepository.getTimeZoneAndDefaultScheduleId({
|
||||
userId,
|
||||
});
|
||||
if (!userData?.timeZone || !userData?.defaultScheduleId) {
|
||||
throw new Error("timeZone and defaultScheduleId not found");
|
||||
|
||||
@@ -12,7 +12,7 @@ import MeetingNotStarted from "~/videos/views/videos-meeting-not-started-single-
|
||||
|
||||
export const generateMetadata = async ({ params, searchParams }: _PageProps) => {
|
||||
const p = { ...params, ...searchParams };
|
||||
const booking = await BookingRepository.findBookingByUidWithOptionalSelect({
|
||||
const booking = await BookingRepository.findBookingByUid({
|
||||
bookingUid: typeof p?.uid === "string" ? p.uid : "",
|
||||
});
|
||||
|
||||
|
||||
@@ -20,34 +20,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
|
||||
const ssr = await ssrInit(context);
|
||||
|
||||
const booking = await BookingRepository.findBookingByUidWithOptionalSelect({
|
||||
const booking = await BookingRepository.findBookingForMeetingPage({
|
||||
bookingUid: context.query.uid as string,
|
||||
select: {
|
||||
uid: true,
|
||||
description: true,
|
||||
isRecorded: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
timeZone: true,
|
||||
name: true,
|
||||
email: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
references: {
|
||||
select: {
|
||||
id: true,
|
||||
uid: true,
|
||||
type: true,
|
||||
meetingUrl: true,
|
||||
meetingPassword: true,
|
||||
},
|
||||
where: {
|
||||
type: "daily_video",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!booking || booking.references.length === 0 || !booking.references[0].meetingUrl) {
|
||||
|
||||
@@ -6,23 +6,8 @@ import { type inferSSRProps } from "@lib/types/inferSSRProps";
|
||||
|
||||
export type PageProps = inferSSRProps<typeof getServerSideProps>;
|
||||
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
const booking = await BookingRepository.findBookingByUidWithOptionalSelect({
|
||||
const booking = await BookingRepository.findBookingForMeetingEndedPage({
|
||||
bookingUid: context.query.uid as string,
|
||||
select: {
|
||||
uid: true,
|
||||
user: {
|
||||
select: {
|
||||
credentials: true,
|
||||
},
|
||||
},
|
||||
references: {
|
||||
select: {
|
||||
uid: true,
|
||||
type: true,
|
||||
meetingUrl: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!booking) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||
|
||||
// change the type
|
||||
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
const booking = await BookingRepository.findBookingByUidWithOptionalSelect({
|
||||
const booking = await BookingRepository.findBookingByUid({
|
||||
bookingUid: context.query.uid as string,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user