chore: [Booking Flow Refactor - 5] Move post booking things to separate service BookingEventHandlerService starting with HashedLink usage handling#24025
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
de2c60a to
34dfdce
Compare
6e09e8f to
62963b2
Compare
BookingEventHandler
| if (error instanceof Error) { | ||
| throw new HttpError({ statusCode: 410, message: error.message }); | ||
| } | ||
|
|
||
| // For unexpected errors, provide a generic message | ||
| throw new HttpError({ statusCode: 500, message: "Failed to process booking link" }); |
There was a problem hiding this comment.
Intentionally removed these errors because Booking is actually successful and this is a Post Booking thing, which we should track for errors but booker shouldn't see any booking failure due to it.
| private readonly hashedLinkRepository: HashedLinkRepository; | ||
| private readonly membershipService: MembershipService; | ||
|
|
||
| constructor(deps: HashedLinkServiceDeps) { |
There was a problem hiding this comment.
Moved to deps because we have a convention to use deps when there are more than one argument to constructor. This is required by bindModuleToClassOnToken implementation.
148bab2 to
4cfb182
Compare
BookingEventHandlerBookingEventHandlerService
4cfb182 to
a01b098
Compare
34dfdce to
748408d
Compare
a01b098 to
1326af2
Compare
volnei
left a comment
There was a problem hiding this comment.
I see we're introducing a new kind of DI which is good but thinking forward I prefer to not go this way right now to maturate a better structure (and place) for DI since lib folder I don't think is the right place.
packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts
Show resolved
Hide resolved
packages/trpc/server/routers/viewer/eventTypes/heavy/update.handler.ts
Outdated
Show resolved
Hide resolved
|
DI wise I am following the existing conventions, nothing new that I can see. But yeah if you are talking about moving DI containers and modules to packages/features that we agreed on today, then yes that needs to be done. |
748408d to
3cbf712
Compare
packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts
Show resolved
Hide resolved
packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts
Show resolved
Hide resolved
packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts
Show resolved
Hide resolved
- Refactor updatePrivateLinkUsage to only accept hashedLink parameter instead of full payload - Remove shouldProcess function and inline isDryRun check for better clarity - Addresses feedback from PR #24025 Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
c3f6beb to
ceb8311
Compare
8696041 to
46be34f
Compare
E2E results are ready! |
- Add HashedLinkService to platform-libraries/private-links.ts - Update API V2 to import from platform library instead of direct path - Fixes MODULE_NOT_FOUND error in API V2 build Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts
Show resolved
Hide resolved
|
@volnei PR looks good to me |
…te service `BookingEventHandlerService` starting with HashedLink usage handling (calcom#24025) * chore: Move post booking stuff to separate service * refactor: improve ISP compliance in BookingEventHandlerService - Refactor updatePrivateLinkUsage to only accept hashedLink parameter instead of full payload - Remove shouldProcess function and inline isDryRun check for better clarity - Addresses feedback from PR calcom#24025 Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * define only what is used * Define hashed-link-service as well in api-v2 * fix: export HashedLinkService through platform-libraries - Add HashedLinkService to platform-libraries/private-links.ts - Update API V2 to import from platform library instead of direct path - Fixes MODULE_NOT_FOUND error in API V2 build Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>

What does this PR do?
This PR refactors post-booking logic by extracting it from the main booking flow into a dedicated
BookingEventHandlerservice. This is the first step in improving the post booking architecture by separating concerns and making the codebase more maintainable.Key Changes:
BookingEventHandlerserviceMandatory Tasks (DO NOT REMOVE)
How should this be tested?
Environment Setup
Test Scenarios
Expected Behavior
packages/features/bookings/lib/handleNewBooking/test/post-booking-handling.test.tsshould passChecklist
BookingEventHandleris properly instantiated and called in the booking flow (around line 2063 inRegularBookingService.ts)HttpErrorto logging errors is the intended behavior for post-booking failuresHashedLinkServicedoesn't break any existing imports or functionalityArchitectural Changes:
BookingEventHandlerclass properly handles both creation and rescheduling eventsonBookingEvents/types.d.tsare comprehensive and accurateBackward Compatibility:
Link to Devin run: https://app.devin.ai/sessions/4465fc388ef1433d80ca534e6c4ec2dd
PR Description Requested by: @hariombalhara
Note: This refactoring provides a foundation for incrementally moving additional post-booking functionality (webhooks, notifications, analytics) into the event handler pattern in future PRs.