refactor: convert EventTypeRepository to use dependency injection pattern (#22397)
- Add constructor with PrismaClient dependency injection - Convert all 14 static methods to instance methods using this.prismaClient - Update all usage sites to use two-step instantiation pattern: const eventTypeRepo = new EventTypeRepository(prisma); eventTypeRepo.method(...) - Keep getSelectedCalendarsFromUser as static utility method - Follow same pattern as UserRepository, TeamRepository, SelectedSlotsRepository, and BookingRepository - Maintain all existing method signatures and functionality 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
b5911a9a2d
commit
758143ef70
14 files changed
+68
-59
No files matched your search
@@ -94,7 +94,8 @@ const checkIfUserIsHost = async ({
|
||||
return booking.user?.id === sessionUserId;
|
||||
}
|
||||
|
||||
const eventType = await EventTypeRepository.findByIdWithUserAccess({
|
||||
const eventTypeRepo = new EventTypeRepository(prisma);
|
||||
const eventType = await eventTypeRepo.findByIdWithUserAccess({
|
||||
id: booking.eventTypeId,
|
||||
userId: sessionUserId,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user