chore: [Booking Cancellation Refactor - 2] Inject repositories and use them instead of Prisma in cancellation flow#66
chore: [Booking Cancellation Refactor - 2] Inject repositories and use them instead of Prisma in cancellation flow#66
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| externalCalendarId: true, | ||
| credentialId: true, | ||
| }, | ||
| gte: bookingToDelete.startTime, |
There was a problem hiding this comment.
Query uses wrong date filter for recurring bookings
High Severity
When cancelling recurring bookings with allRemainingBookings=true, the updateMany call uses gte: new Date() (via the gte variable) to cancel bookings from now onwards, but findManyIncludeWorkflowRemindersAndReferences uses gte: bookingToDelete.startTime which could be in the past. This mismatch causes the find query to return bookings that weren't actually cancelled, potentially deleting workflow reminders for active bookings. The find query should use the same gte variable to ensure consistency with what was actually cancelled.
| createdDate: true, | ||
| trialEndsAt: true, | ||
| completedOnboarding: true, | ||
| locale: true, |
There was a problem hiding this comment.
Missing locale field breaks organizer language preference
Medium Severity
The locale field was removed from userSelect in UserRepository.ts, but handleCancelBooking.ts still accesses organizer.locale to determine the translation language. Since locale is no longer selected, organizer.locale is always undefined, causing all organizer communications (emails, translations) to default to English regardless of the organizer's actual language preference.
Benchmark PR from qodo-benchmark#682
Note
Modernizes the booking cancellation flow by replacing direct
Prismacalls with injected repositories and expanding DI wiring across API and features packages.handleCancelBookingwith injecteduserRepository,bookingRepository,profileRepository,bookingReferenceRepository, andattendeeRepository; handler now accepts dependencies and service wires them via DIIBookingRepository,IBookingReferenceRepository,IProfileRepository,IBookingAttendeeRepository; extendBookingRepositorywithupdateMany,updateIncludeWorkflowRemindersAndReferences, andfindManyIncludeWorkflowRemindersAndReferences; addBookingReferenceRepository.updateManyByBookingId; makeProfileRepositoryDI-aware withfindFirstByUserIdBookingCancelService.moduleand APIBookingCancelModuleproviders; export new repos via@calcom/platform-libraries/repositoriesWritten by Cursor Bugbot for commit 8cb1511. Configure here.