chore: App router migration - Add method to BookingRepository & Extract /videos/**/* into /modules and /lib (#16466)
* meeting-ended: refactor and extract client code into /modules * meeting-not-started: refactor and extract client code into /modules * meeting-not-found: fix getData * BookingRepository: add a new method * video: refactor and extract client code into /modules * refactor * refactor getServerSideProps * use findBookingByUid for more getServerSideProps functions * rename findBookingByUid -> findBookingByUidWithOptionalSelect * add safety
This commit is contained in:
1 parent
6bb60e36fd
commit
12a9c74eb6
15 files changed
+69
-75
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import type { Prisma } from "@prisma/client";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
|
||||
import { BookingStatus } from "@calcom/prisma/enums";
|
||||
|
||||
import { UserRepository } from "./user";
|
||||
@@ -113,6 +113,21 @@ export class BookingRepository {
|
||||
return allBookings;
|
||||
}
|
||||
|
||||
static async findBookingByUidWithOptionalSelect({
|
||||
bookingUid,
|
||||
select,
|
||||
}: {
|
||||
bookingUid: string;
|
||||
select?: Prisma.BookingSelect;
|
||||
}) {
|
||||
return await prisma.booking.findUnique({
|
||||
where: {
|
||||
uid: bookingUid,
|
||||
},
|
||||
select: { ...bookingMinimalSelect, ...select },
|
||||
});
|
||||
}
|
||||
|
||||
static async findBookingByUidAndUserId({ bookingUid, userId }: { bookingUid: string; userId: number }) {
|
||||
return await prisma.booking.findFirst({
|
||||
where: {
|
||||
|
||||
Reference in new issue
Block a user