-
Notifications
You must be signed in to change notification settings - Fork 11.7k
refactor: evt calendar event builder #27203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| if (reqBody.recurringEventId && eventType.recurringEvent) { | ||
| // Overriding the recurring event configuration count to be the actual number of events booked for | ||
| // the recurring event (equal or less than recurring event configuration count) | ||
| eventType.recurringEvent = Object.assign({}, eventType.recurringEvent, { count: recurringCount }); | ||
| evt.recurringEvent = eventType.recurringEvent; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this where evt is being created
|
|
||
| if (input.bookingData.thirdPartyRecurringEventId) { | ||
| const updatedEvt = CalendarEventBuilder.fromEvent(evt) | ||
| ?.withRecurringEventId(input.bookingData.thirdPartyRecurringEventId) | ||
| .build(); | ||
|
|
||
| if (!updatedEvt) { | ||
| throw new HttpError({ | ||
| statusCode: 400, | ||
| message: "Failed to build event with recurring event ID due to missing required fields", | ||
| }); | ||
| } | ||
|
|
||
| evt = updatedEvt; | ||
| } | ||
|
|
||
| if (isTeamEventType) { | ||
| const teamEvt = await buildEventForTeamEventType({ | ||
| existingEvent: evt, | ||
| schedulingType: eventType.schedulingType, | ||
| users, | ||
| team: eventType.team, | ||
| organizerUser, | ||
| }); | ||
|
|
||
| if (!teamEvt) { | ||
| throw new HttpError({ statusCode: 400, message: "Failed to build team event" }); | ||
| } | ||
|
|
||
| evt = teamEvt; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a withConditional method that would help us do this inside calendar event builder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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="packages/features/CalendarEventBuilder.ts">
<violation number="1" location="packages/features/CalendarEventBuilder.ts:556">
P2: withConditional should skip undefined data as well as null; currently undefined still triggers apply() and violates the NonNullable<T> assumption.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
Co-Authored-By: unknown <>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files (changes from recent commits).
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="packages/features/CalendarEventBuilder.ts">
<violation number="1" location="packages/features/CalendarEventBuilder.ts:571">
P2: Use ErrorWithCode (or ErrorWithCode.Factory.BadRequest) in packages/features instead of HttpError so errors are translated consistently by middleware.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
|
Reviewed the Cubic AI feedback for the issue at The confidence score for this issue is 7/10, which is below the 9/10 threshold required for automated fixes. Skipping this issue per the review guidelines. If the PR author believes this change should be made, they can manually update the code to use |
What does this PR do?
This PR refactors calendar event builder and prevents re assignment of
evtMandatory Tasks (DO NOT REMOVE)
How should this be tested?
Summary by cubic
Refactored calendar event creation to build complete events in one pass using CalendarEventBuilder, covering team, recurring, and video call data. This simplifies booking logic and reduces post-build mutations and error paths.
Written for commit a644ff1. Summary will update on new commits.