Skip to content

fix(api): return original email without OAuth suffix in bookings#15

Open
tomerqodo wants to merge 2 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base_fixapi_return_original_email_without_oauth_suffix_in_bookings_pr700from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head_fixapi_return_original_email_without_oauth_suffix_in_bookings_pr700
Open

fix(api): return original email without OAuth suffix in bookings#15
tomerqodo wants to merge 2 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base_fixapi_return_original_email_without_oauth_suffix_in_bookings_pr700from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head_fixapi_return_original_email_without_oauth_suffix_in_bookings_pr700

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 22, 2026

Benchmark PR from qodo-benchmark#700

Summary by CodeRabbit

Release Notes

  • New Features
    • Added displayEmail field to all booking API responses for attendees, hosts, and reassigned-to users, providing a cleaner email format suitable for UI display.
    • Added displayGuests field to booking responses for enhanced guest data representation.
    • Expanded booking response schemas across all booking types (single, recurring, seated, team, and organization) to include additional metadata fields.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

Adds displayEmail fields to booking-related API responses by introducing a normalization method that strips plus-addressing suffixes from email addresses. Updates include schema definitions, service implementations, type exports, and comprehensive e2e test coverage.

Changes

Cohort / File(s) Summary
OpenAPI Schema & Type Definitions
docs/api-reference/v2/openapi.json, packages/platform/types/bookings/2024-08-13/outputs/booking.output.ts
Added displayEmail fields to BookingAttendee, BookingHost, and ReassignedToDto with appropriate decorators and documentation. Added static helper method cleanEmailForDisplay() to normalize emails. Expanded schemas for BookingOutput, RecurringBookingOutput, and variants with metadata and additional properties.
Validation Configuration
.github/oasdiff-err-ignore.txt
Updated OpenAPI diff ignore rules for new subschema references in booking endpoints' response properties.
Service Implementation
apps/api/v2/src/ee/bookings/2024-08-13/services/output.service.ts
Introduced private getDisplayEmail() helper to normalize emails by stripping plus-addressing. Propagated displayEmail and displayGuests fields across all booking output builders (attendees, hosts, reassignment, recurring, and seated bookings). Removed unnecessary sorting in recurring booking queries.
E2E Tests — Booking Endpoints
apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/api-key-bookings.e2e-spec.ts, managed-user-bookings.e2e-spec.ts, recurring-bookings.e2e-spec.ts, seated-bookings.e2e-spec.ts, team-bookings.e2e-spec.ts, user-bookings.e2e-spec.ts, reassign-bookings.e2e-spec.ts
Updated test assertions to expect displayEmail field on attendee and host objects, along with displayGuests on booking responses. Validates that displayEmail mirrors the email value in various booking creation, retrieval, and reassignment scenarios.
E2E Tests — Organization Bookings
apps/api/v2/src/modules/organizations/bookings/organizations-bookings.controller.e2e-spec.ts, organizations/teams/bookings/organizations-teams-bookings.controller.e2e-spec.ts, organizations/users/bookings/controllers/organizations-users-bookings.e2e-spec.ts
Extended test expectations to verify displayEmail field presence in organization-scoped booking responses and attendee objects.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Poem

A field springs forth for every attendee,
Where emails glow without their plusses free,
Through services and tests it hops along,
A rabbit's touch makes schemas strong,
Display with grace, no CUID in sight! 🐰✉️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding displayEmail fields to booking responses to return original emails without OAuth suffixes, which is the core focus across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/api/v2/src/ee/bookings/2024-08-13/services/output.service.ts (1)

411-425: Add missing date sorting to match sibling functions.
This function omits the .sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()) that both getOutputRecurringBookings (line 243) and getOutputCreateRecurringSeatedBookings (line 448) apply. Results are returned in bookingsIds input order instead of sorted by start date. Add the sort call before returning to match the consistent behavior of related functions.

🧹 Nitpick comments (2)
packages/platform/types/bookings/2024-08-13/outputs/booking.output.ts (1)

59-62: Centralize email display normalization to avoid regex drift.
The helper duplicates the normalization logic in the output service; consider moving the regex into a shared utility (e.g., platform-libraries) and reuse it from both locations to prevent divergence.

apps/api/v2/src/ee/bookings/2024-08-13/services/output.service.ts (1)

167-173: Avoid unbound method references in map.
map(this.getDisplayEmail) relies on current method implementation; if getDisplayEmail ever uses this, it will break. Prefer an arrow for safety and consistency with the later block.

♻️ Safer callback binding
-      bookingTransformed.bookingFieldsResponses.displayGuests = bookingTransformed.bookingFieldsResponses.guests.map(
-        this.getDisplayEmail
-      );
+      bookingTransformed.bookingFieldsResponses.displayGuests =
+        bookingTransformed.bookingFieldsResponses.guests.map((guest) => this.getDisplayEmail(guest));
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b2481b0 and 7def632.

📒 Files selected for processing (14)
  • .github/oasdiff-err-ignore.txt
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/api-key-bookings.e2e-spec.ts
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/managed-user-bookings.e2e-spec.ts
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/reassign-bookings.e2e-spec.ts
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/recurring-bookings.e2e-spec.ts
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/seated-bookings.e2e-spec.ts
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/team-bookings.e2e-spec.ts
  • apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/user-bookings.e2e-spec.ts
  • apps/api/v2/src/ee/bookings/2024-08-13/services/output.service.ts
  • apps/api/v2/src/modules/organizations/bookings/organizations-bookings.controller.e2e-spec.ts
  • apps/api/v2/src/modules/organizations/teams/bookings/organizations-teams-bookings.controller.e2e-spec.ts
  • apps/api/v2/src/modules/organizations/users/bookings/controllers/organizations-users-bookings.e2e-spec.ts
  • docs/api-reference/v2/openapi.json
  • packages/platform/types/bookings/2024-08-13/outputs/booking.output.ts
🔇 Additional comments (34)
.github/oasdiff-err-ignore.txt (1)

5-10: LGTM — oasdiff ignores updated for new booking response shapes.

These entries look consistent with the added subschemas for bookings responses.

packages/platform/types/bookings/2024-08-13/outputs/booking.output.ts (1)

32-35: displayEmail schema additions look consistent.

Also applies to: 108-112, 414-417

apps/api/v2/src/ee/bookings/2024-08-13/services/output.service.ts (2)

96-98: Verify OAuth suffix format matches the regex.
If the suffix isn’t exactly 25 alnum chars at the end of the local-part, this won’t strip it (or could strip unintended content). Please confirm the format and consider anchoring the match to @.

✅ If suffix is a 25-char token at end of local-part
-  private getDisplayEmail(email: string): string {
-    return email.replace(/\+[a-zA-Z0-9]{25}/, "");
-  }
+  private getDisplayEmail(email: string): string {
+    return email.replace(/\+[\w-]{25}(?=@)/, "");
+  }

131-139: displayEmail propagation across outputs is consistent.

Also applies to: 158-165, 275-282, 303-310, 313-318, 383-389, 512-518, 213-228, 544-551

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/api-key-bookings.e2e-spec.ts (1)

177-184: Test expectation update aligns with new response shape.

apps/api/v2/src/modules/organizations/teams/bookings/organizations-teams-bookings.controller.e2e-spec.ts (1)

250-257: displayEmail assertion matches updated attendee schema.

apps/api/v2/src/modules/organizations/bookings/organizations-bookings.controller.e2e-spec.ts (1)

335-342: displayEmail expectations correctly mirror the new attendee payload.

Also applies to: 389-396, 443-450, 497-504

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/team-bookings.e2e-spec.ts (1)

519-526: displayEmail expectations are consistent across booking scenarios.

Also applies to: 574-582, 631-646, 694-701, 749-756, 933-941, 1017-1024

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/seated-bookings.e2e-spec.ts (4)

201-215: Looks good: attendee displayEmail included in create seated booking response.


276-307: Looks good: displayEmail assertions added for both attendees.


421-434: Looks good: rescheduled attendee displayEmail is covered.


845-859: Looks good: displayEmail asserted in host-cancel flow booking payload.

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/recurring-bookings.e2e-spec.ts (2)

176-216: Looks good: displayEmail assertions added for recurring booking attendees.


255-317: Looks good: displayEmail covered across all recurrences.

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/reassign-bookings.e2e-spec.ts (2)

491-496: Looks good: reassignedTo.displayEmail verified.


532-537: Looks good: displayEmail covered for targeted reassignment.

apps/api/v2/src/modules/organizations/users/bookings/controllers/organizations-users-bookings.e2e-spec.ts (3)

233-240: Looks good: displayEmail included in personal booking attendee assertion.


292-299: Looks good: displayEmail assertion added for username-based booking.


349-356: Looks good: displayEmail asserted for team booking attendee.

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/user-bookings.e2e-spec.ts (7)

233-240: Looks good: displayEmail asserted in personal booking attendee.


292-299: Looks good: displayEmail asserted for username-based personal booking.


349-356: Looks good: displayEmail asserted for team booking attendee.


483-505: Looks good: displayEmail/displayGuests expectations added to bookingFieldsResponses.


569-621: Looks good: displayEmail covered across recurring booking attendees.


2083-2105: Looks good: displayEmail/displayGuests covered for username + slug booking path.


2536-2551: Looks good: displayEmail asserted for attendee SMS reminder flow.

apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/managed-user-bookings.e2e-spec.ts (1)

627-709: Nice coverage: displayEmail/displayGuests validated for managed-user flows.

docs/api-reference/v2/openapi.json (7)

31715-31719: displayEmail field is clearly documented.
Example and description align with the existing email field.


31729-31735: Required list update looks correct.
Including displayEmail alongside email makes the contract explicit.


31766-31770: Consistent displayEmail documentation.
Matches the email schema pattern and is easy to understand.


31833-31838: Required list is aligned with the new field.
Good to mark displayEmail as guaranteed.


32183-32187: displayEmail addition is consistent with other schemas.
No issues here.


32267-32273: Required list update is appropriate.
Keeps the contract consistent with added field.


33364-33375: Schema and required updates look good.
displayEmail is documented and required as expected.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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