[CORRUPTED] Synthetic Benchmark PR #25312 - fix: break circular dependency between reminderScheduler and credit-service#86
Conversation
…ervice - Created WorkflowReminderRepository to handle workflow reminder queries - Refactored cancelScheduledMessagesAndScheduleEmails to accept userIdsWithoutCredits parameter - Moved credit-checking logic from workflows to CreditService - Changed dynamic import to static import in CreditService - Updated tests to pass userIdsWithoutCredits parameter - Removed unused imports (prisma, WorkflowMethods) This creates a one-way dependency (billing -> workflows) and follows the repository pattern by removing direct Prisma usage from reminderScheduler. Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
- Use MembershipRepository.listAcceptedTeamMemberIds instead of findAllAcceptedPublishedTeamMemberships - Re-add prisma import to reminderScheduler.ts for UserRepository - Update WorkflowReminderRepository to use WorkflowActions enum instead of string Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
…pendency-1763729923
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
User description
Benchmark PR calcom#25312
Type: Corrupted (contains bugs)
Original PR Title: fix: break circular dependency between reminderScheduler and credit-service
Original PR Description: ## What does this PR do?
packages/features/ee/workflows/lib/reminders/reminderScheduler.tsandpackages/features/ee/billing/credit-service.tsWorkflowReminderRepositoryfor prisma queries and madecancelScheduledMessagesAndScheduleEmailsaccept pre-computeduserIdsWithNoCreditsparameterMandatory Tasks (DO NOT REMOVE)
How should this be tested?
Original PR URL: fix: break circular dependency between reminderScheduler and credit-service calcom/cal.com#25312
PR Type
Bug fix, Enhancement
Description
Breaks circular dependency between reminderScheduler and credit-service
Moves credit-checking logic to CreditService with new private method
Creates WorkflowReminderRepository to encapsulate Prisma queries
Refactors cancelScheduledMessagesAndScheduleEmails to accept pre-computed userIdsWithNoCredits parameter
Updates tests to pass userIdsWithNoCredits instead of computing internally
Diagram Walkthrough
File Walkthrough
credit-service.ts
Add credit-checking logic to CreditServicepackages/features/ee/billing/credit-service.ts
_getUserIdsWithoutCreditsto compute user IDswithout available credits
cancelScheduledMessagesAndScheduleEmailsto passpre-computed
userIdsWithNoCreditsparameterWorkflowReminderRepository.ts
Create WorkflowReminderRepository for database operationspackages/features/ee/workflows/repositories/WorkflowReminderRepository.ts
operations
findScheduledMessagesToCancelmethod to query remindersfor users without credits
updateRemindersToEmailmethod to convert SMS reminders toemail
reminderScheduler.ts
Refactor to use WorkflowReminderRepository and accept pre-computedcreditspackages/features/ee/workflows/lib/reminders/reminderScheduler.ts
userIdsWithNoCreditsparameterinstead of computing it
WorkflowMethodsimport and simplified method filteringreminderScheduler.test.ts
Update tests to use userIdsWithNoCredits parameterpackages/features/ee/workflows/lib/reminders/reminderScheduler.test.ts
userIdsWithNoCreditsparameter instead ofuserIdorteamIdprismaMock.membership.findManymock setupused in queries