refactor: Use confirmHandler directly in link and verify-booking-token routes[booking-audit-prerequisite]#26567
Merged
Udit-takkar merged 2 commits intomainfrom Jan 8, 2026
Conversation
…n routes Refactors the link and verify-booking-token API routes to call confirmHandler directly instead of using the tRPC caller pattern. This simplifies the code by removing the need for session getter, legacy request building, and context creation. Changes: - apps/web/app/api/link/route.ts: Use confirmHandler directly with ctx and input - apps/web/app/api/verify-booking-token/route.ts: Use confirmHandler directly with ctx and input - Updated tests to mock confirmHandler instead of tRPC caller Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
14 tasks
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/web/app/api/verify-booking-token/__tests__/route.test.ts">
<violation number="1" location="apps/web/app/api/verify-booking-token/__tests__/route.test.ts:50">
P2: Mock for `findUniqueOrThrow` returns `null` instead of throwing when record is not found. This doesn't match Prisma's actual behavior where `findUniqueOrThrow` throws an error if no record exists.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Udit-takkar
reviewed
Jan 8, 2026
Comment on lines
+56
to
+61
| select: { | ||
| id: true, | ||
| uuid: true, | ||
| email: true, | ||
| username: true, | ||
| role: true, |
Contributor
There was a problem hiding this comment.
we should move all the prisma queries to repository in follow up
Udit-takkar
approved these changes
Jan 8, 2026
Member
Author
Merge activity
|
Contributor
E2E results are ready! |
Anshumancanrock
pushed a commit
to Anshumancanrock/cal.com
that referenced
this pull request
Jan 12, 2026
…n routes (calcom#26567) Refactors the link and verify-booking-token API routes to call confirmHandler directly instead of using the tRPC caller pattern. This simplifies the code by removing the need for session getter, legacy request building, and context creation. Changes: - apps/web/app/api/link/route.ts: Use confirmHandler directly with ctx and input - apps/web/app/api/verify-booking-token/route.ts: Use confirmHandler directly with ctx and input - Updated tests to mock confirmHandler instead of tRPC caller Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This was referenced Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Refactors the
/api/linkand/api/verify-booking-tokenAPI routes to callconfirmHandlerdirectly instead of using the tRPC caller pattern. This simplifies the code by removing boilerplate for session getters, legacy request building, and context creation.This PR is extracted from #26523 to create a smaller, focused change that can serve as a base for the booking audit integration work.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Test the magic link booking confirmation flow:
Test the verify-booking-token flow:
Run the unit tests:
TZ=UTC yarn test apps/web/app/api/link/__tests__/route.test.ts apps/web/app/api/verify-booking-token/__tests__/route.test.tsHuman Review Checklist
confirmHandlerdirectly produces the same behavior as the previous tRPC caller patternconfirmHandleremailsEnabled: trueis the correct default for these routestraceContextis properly constructed withdistributedTracing.createTrace()Checklist
Link to Devin run: https://app.devin.ai/sessions/c75b539122974b3380ac2d2d68322e16
Requested by: @hariombalhara