Skip to content

Comments

fix: return rescheduledByEmail in V2 bookings#22804

Merged
alishaz-polymath merged 10 commits intomainfrom
feat/v2-bookings-return-rescheduledByEmail
Jul 31, 2025
Merged

fix: return rescheduledByEmail in V2 bookings#22804
alishaz-polymath merged 10 commits intomainfrom
feat/v2-bookings-return-rescheduledByEmail

Conversation

@alishaz-polymath
Copy link
Member

@alishaz-polymath alishaz-polymath commented Jul 30, 2025

What does this PR do?

Fixes the bug where we try to fetch rescheduledByEmail from the new booking instead of the original booking that was rescheduled.

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 30, 2025

Walkthrough

The changes update the logic for retrieving and handling rescheduling information in the booking output service. The previous method, which returned only the UID of a rescheduled booking, is replaced with a new method that returns both the UID and the email of the user who performed the rescheduling. Calls to the old method are updated to use the new method, and the returned object is destructured accordingly. The construction of booking output objects is modified to use the newly obtained email information, and the method signature is updated to reflect the new return type. Additionally, a new end-to-end test case is added to verify that the rescheduled booking output correctly includes the email of the user who performed the reschedule.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d8ec96 and 5e707ab.

📒 Files selected for processing (1)
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/user-bookings.e2e-spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/user-bookings.e2e-spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/v2-bookings-return-rescheduledByEmail

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Jul 30, 2025
@alishaz-polymath alishaz-polymath marked this pull request as ready for review July 30, 2025 13:07
@alishaz-polymath alishaz-polymath requested a review from a team July 30, 2025 13:07
@alishaz-polymath alishaz-polymath requested a review from a team as a code owner July 30, 2025 13:07
@vercel
Copy link

vercel bot commented Jul 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Jul 31, 2025 0:50am
cal-eu ⬜️ Ignored (Inspect) Jul 31, 2025 0:50am

@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking platform Anything related to our platform plan 🐛 bug Something isn't working labels Jul 30, 2025
databaseBooking.status === "CANCELLED" ? databaseBooking.cancellationReason : undefined,
cancelledByEmail: databaseBooking.status === "CANCELLED" ? databaseBooking.cancelledBy : undefined,
reschedulingReason: bookingResponses?.rescheduledReason,
rescheduledByEmail: databaseBooking.rescheduledBy || undefined,
Copy link
Member Author

Choose a reason for hiding this comment

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

The current (rescheduled) booking would not contain this detail as it is stored in the previous (original) booking, just like rescheduledToUid. So we fetch it from there.

supalarry

This comment was marked as resolved.

@alishaz-polymath
Copy link
Member Author

  1. "getOutputBooking" returns a booking. Let's say we want to return original booking that was rescheduled (so the one that is now cancelled) - would your newly added getRescheduledToInfo return its "rescheduledBy" ? Because "getRescheduledToInfo" calls "getByFromReschedule" and the original booking has not been rescheduled by anything as that is the original booking.

No, maybe we should add it for both original and new bookings. Let me update 🙏

@github-actions
Copy link
Contributor

github-actions bot commented Jul 31, 2025

E2E results are ready!

@alishaz-polymath
Copy link
Member Author

  1. "getOutputBooking" returns a booking. Let's say we want to return original booking that was rescheduled (so the one that is now cancelled) - would your newly added getRescheduledToInfo return its "rescheduledBy" ? Because "getRescheduledToInfo" calls "getByFromReschedule" and the original booking has not been rescheduled by anything as that is the original booking.
  2. Can we add a new test in "apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/user-bookings.e2e-spec.ts" ? We already have test "it("should return who rescheduled a booking", async () => {" that returns originally scheduled booking that was rescheduled (the e2e tests have not run in E2E and i think it would fail with the current implementation"

Both points addressed!

Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Looks good!

@alishaz-polymath alishaz-polymath merged commit ad4af64 into main Jul 31, 2025
40 checks passed
@alishaz-polymath alishaz-polymath deleted the feat/v2-bookings-return-rescheduledByEmail branch July 31, 2025 15:27
@coderabbitai coderabbitai bot mentioned this pull request Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO platform Anything related to our platform plan ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants