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:
devin-ai-integration[bot]and[email protected] authored and GitHub committed 2025-07-11 10:39:22 +03:00
1 parent b5911a9a2d
commit 758143ef70
14 files changed
+68 -59

No files matched your search

@@ -61,7 +61,8 @@ describe("deleteCredential", () => {
await setupCredential({ userId: user.id, type: "zoom_video", appId: "zoom" });
await handleDeleteCredential({ userId: user.id, userMetadata: user.metadata, credentialId: 123 });
const eventTypeQuery = await EventTypeRepository.findAllByUserId({ userId: user.id });
const eventTypeRepo = new EventTypeRepository(prisma);
const eventTypeQuery = await eventTypeRepo.findAllByUserId({ userId: user.id });
// Ensure that the event type with the deleted app was converted back to daily
const changedEventType = eventTypeQuery.find((eventType) => eventType.id === 1)?.locations;