refactor: convert BookingRepository to use dependency injection pattern (#22389)
* refactor: convert BookingRepository to use dependency injection pattern - Add constructor injection for PrismaClient to BookingRepository - Convert all static methods to instance methods using this.prismaClient - Update all usage sites to use two-step instantiation pattern: const bookingRepo = new BookingRepository(prisma); bookingRepo.method(...) - Apply same dependency injection pattern as UserRepository, TeamRepository, and SelectedSlotsRepository - Update test files to use correct prismaMock import paths - Maintain all existing functionality and type safety Files updated: - BookingRepository class structure and all 15 static methods - Video meeting pages and booking views - Booking utilities and services (handleNewBooking, originalRescheduledBookingUtils) - Round robin handlers and reassignment logic - Interval limits and booking limits checking - Test files with proper mocking setup Co-Authored-By: [email protected] <[email protected]> * chore: bump platform libs --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]>
This commit is contained in:
1 parent
80ac118242
commit
c316721051
21 files changed
+124
-88
No files matched your search
@@ -77,7 +77,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
|
||||
let rescheduledToUid: string | null = null;
|
||||
if (bookingInfo.rescheduled) {
|
||||
const rescheduledTo = await BookingRepository.findFirstBookingByReschedule({
|
||||
const bookingRepo = new BookingRepository(prisma);
|
||||
const rescheduledTo = await bookingRepo.findFirstBookingByReschedule({
|
||||
originalBookingUid: bookingInfo.uid,
|
||||
});
|
||||
rescheduledToUid = rescheduledTo?.uid ?? null;
|
||||
@@ -89,7 +90,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
} | null = null;
|
||||
|
||||
if (bookingInfo.fromReschedule) {
|
||||
previousBooking = await BookingRepository.findReschedulerByUid({
|
||||
const bookingRepo = new BookingRepository(prisma);
|
||||
previousBooking = await bookingRepo.findReschedulerByUid({
|
||||
uid: bookingInfo.fromReschedule,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user