Skip to content

Comments

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

Open
tomerqodo wants to merge 2 commits intocursor_combined_20260121_demo_base_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr664from
cursor_combined_20260121_demo_head_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr664
Open

chore: [Booking Cancellation Refactor - 2] Inject repositories and use them instead of Prisma in cancellation flow#60
tomerqodo wants to merge 2 commits intocursor_combined_20260121_demo_base_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr664from
cursor_combined_20260121_demo_head_chore_booking_cancellation_refactor_-_2_inject_repositories_and_use_them_instead_of_prisma_in_cancellation_flow_pr664

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 21, 2026

Benchmark PR from qodo-benchmark#664


Note

Modernizes the booking cancellation flow to use repository-based DI instead of direct Prisma and adds supporting infrastructure and tests.

  • Switches handleCancelBooking and API BookingCancelService to injected user, booking, profile, bookingReference, and attendee repositories
  • Adds methods to BookingRepository (updateMany, updateIncludeWorkflowRemindersAndReferences, findManyIncludeWorkflowRemindersAndReferences) and implements DTO interfaces (IBookingRepository, IBookingReferenceRepository, IProfileRepository)
  • Implements PrismaBookingAttendeeRepository with deleteManyByBookingId and extends BookingReferenceRepository with updateManyByBookingId
  • Wires new DI modules/tokens for BookingReferenceRepository, BookingAttendeeRepository, and ProfileRepository; updates Nest module providers in booking-cancel.module.ts
  • Updates ProfileRepository to be DI-ready and adds findFirstByUserId
  • Adds tests covering seated event attendee deletion, bulk/subsequent recurring cancellations, and booking reference cleanup

Written by Cursor Bugbot for commit 72b8c3a. 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.

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 causes incorrect organizer translation

Medium Severity

The locale field was removed from userSelect in UserRepository.ts, but handleCancelBooking.ts still accesses organizer.locale at lines 337 and 370 to determine the organizer's translation language. Since findByIdOrThrow uses userSelect which no longer includes locale, the organizer's locale will always be undefined, causing the translation to fall back to "en" regardless of the organizer's actual language preference. This affects cancellation emails and notifications.

Additional Locations (1)

Fix in Cursor Fix in Web

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 filter mismatch in recurring booking cancellation

Medium Severity

The findManyIncludeWorkflowRemindersAndReferences query uses gte: bookingToDelete.startTime while the preceding updateMany uses a conditionally computed gte value (cancelSubsequentBookings ? bookingToDelete.startTime : new Date()). When allRemainingBookings is true but cancelSubsequentBookings is false, the updateMany cancels bookings from new Date() onwards, but the find query fetches bookings from bookingToDelete.startTime, potentially including bookings that weren't actually cancelled.

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