Skip to content

Comments

chore: [Booking Cancellation Refactor - 2] Inject repositories and use them instead of Prisma in cancellation flow#66

Open
tomerqodo wants to merge 2 commits intocursor_combined_20260121_qodo_grep_cursor_copilot_1_base_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr682from
cursor_combined_20260121_qodo_grep_cursor_copilot_1_head_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr682
Open

chore: [Booking Cancellation Refactor - 2] Inject repositories and use them instead of Prisma in cancellation flow#66
tomerqodo wants to merge 2 commits intocursor_combined_20260121_qodo_grep_cursor_copilot_1_base_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr682from
cursor_combined_20260121_qodo_grep_cursor_copilot_1_head_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr682

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 21, 2026

Benchmark PR from qodo-benchmark#682


Note

Modernizes the booking cancellation flow by replacing direct Prisma calls with injected repositories and expanding DI wiring across API and features packages.

  • Replace direct DB access in handleCancelBooking with injected userRepository, bookingRepository, profileRepository, bookingReferenceRepository, and attendeeRepository; handler now accepts dependencies and service wires them via DI
  • Introduce/implement repo interfaces: IBookingRepository, IBookingReferenceRepository, IProfileRepository, IBookingAttendeeRepository; extend BookingRepository with updateMany, updateIncludeWorkflowRemindersAndReferences, and findManyIncludeWorkflowRemindersAndReferences; add BookingReferenceRepository.updateManyByBookingId; make ProfileRepository DI-aware with findFirstByUserId
  • Add DI modules/tokens for attendee/reference/profile repos and update BookingCancelService.module and API BookingCancelModule providers; export new repos via @calcom/platform-libraries/repositories
  • Tests: add cases for seated event attendee cleanup, recurring all-remaining/subsequent cancellations, and booking reference cleanup during cancellation

Written by Cursor Bugbot for commit 8cb1511. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

createdDate: true,
trialEndsAt: true,
completedOnboarding: true,
locale: true,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant