fix(api): return original email without OAuth suffix in bookings#15
Conversation
WalkthroughAdds Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
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 bothgetOutputRecurringBookings(line 243) andgetOutputCreateRecurringSeatedBookings(line 448) apply. Results are returned inbookingsIdsinput 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 inmap.
map(this.getDisplayEmail)relies on current method implementation; ifgetDisplayEmailever usesthis, 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
📒 Files selected for processing (14)
.github/oasdiff-err-ignore.txtapps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/api-key-bookings.e2e-spec.tsapps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/managed-user-bookings.e2e-spec.tsapps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/reassign-bookings.e2e-spec.tsapps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/recurring-bookings.e2e-spec.tsapps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/seated-bookings.e2e-spec.tsapps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/team-bookings.e2e-spec.tsapps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/user-bookings.e2e-spec.tsapps/api/v2/src/ee/bookings/2024-08-13/services/output.service.tsapps/api/v2/src/modules/organizations/bookings/organizations-bookings.controller.e2e-spec.tsapps/api/v2/src/modules/organizations/teams/bookings/organizations-teams-bookings.controller.e2e-spec.tsapps/api/v2/src/modules/organizations/users/bookings/controllers/organizations-users-bookings.e2e-spec.tsdocs/api-reference/v2/openapi.jsonpackages/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:displayEmailfield is clearly documented.
Example and description align with the existing
31729-31735: Required list update looks correct.
IncludingdisplayEmailalongside
31766-31770: ConsistentdisplayEmaildocumentation.
Matches the email schema pattern and is easy to understand.
31833-31838: Required list is aligned with the new field.
Good to markdisplayEmailas guaranteed.
32183-32187:displayEmailaddition 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.
displayEmailis documented and required as expected.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Benchmark PR from qodo-benchmark#700
Summary by CodeRabbit
Release Notes
displayEmailfield to all booking API responses for attendees, hosts, and reassigned-to users, providing a cleaner email format suitable for UI display.displayGuestsfield to booking responses for enhanced guest data representation.✏️ Tip: You can customize this high-level summary in your review settings.