Skip to content

12690-error-unknown-error-importing-calendar-events-reafcto-required #12711

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

Conversation

guillim
Copy link
Contributor

@guillim guillim commented Jun 18, 2025

Why : we had an issue impoting events du to CalendarEvents not yet existing while inserting the CalendarChannelAssociation due to inverted method in the service

This PR refactors the calendar event import logic by

  • renaming
  • splitting utility functions for better clarity and maintainability.
  • adding TSDoc comments to explain the purpose and uniqueness of the eventExternalId field in calendar event associations

Fixes #12690

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Refactored calendar event import logic to fix foreign key constraint violations during calendar event synchronization, ensuring events exist before creating associations.

  • Introduced new existingCalendarEventsMapper utility in calendar-event-mapper.util.ts to replace the removed inject-ids-in-calendar-events.util.ts
  • Restructured calendar-save-events.service.ts to handle event creation before associations
  • Added TSDoc comments in calendar-channel-event-association.workspace-entity.ts explaining eventExternalId uniqueness
  • Improved error handling for cases where calendar events are not found during import

4 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Jun 18, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:60050

This environment will automatically shut down when the PR is closed or after 5 hours.

};
});

const participantsToSave = filteredEventsWithParticipantsCalendarEventId
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused by this logic. How updating or saving participants is tied to the fact that the event is already present in DB or not. I would expect us to compare existing participants with new ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is related to the construction of the submethod that are responsible to handle the participants.
I did not investigate, but I guess it is a simple insert for new events, while there is a comparison to do for the updated ones.

Could be refacto as well

@bosiraphael bosiraphael changed the title Git-fetch-origin-git-checkout-12690-error-unknown-error-importing-calendar-events-reafcto-required 12690-error-unknown-error-importing-calendar-events-reafcto-required Jun 19, 2025
@bosiraphael bosiraphael self-requested a review June 19, 2025 08:39
@bosiraphael
Copy link
Contributor

I feel like the original error may come from this permission PR #11818 since it is the last PR that edited the CalendarSaveEventsService, and that the error is a foreign key error that appeared on sentry at the last release #12690 @ijreilly @Weiko

@guillim guillim enabled auto-merge (squash) June 19, 2025 15:01
@guillim guillim merged commit 6d56b75 into main Jun 19, 2025
42 checks passed
@guillim guillim deleted the git-fetch-origin-git-checkout-12690-error-unknown-error-importing-calendar-events-reafcto-required branch June 19, 2025 15:04
ijreilly pushed a commit that referenced this pull request Jun 19, 2025
…12711)

Why : we had an issue impoting events du to CalendarEvents not yet
existing while inserting the CalendarChannelAssociation due to inverted
method in the service

This PR refactors the calendar event import logic by 
- renaming 
- splitting utility functions for better clarity and maintainability. 
- adding TSDoc comments to explain the purpose and uniqueness of the
`eventExternalId` field in calendar event associations


Fixes #12690

---------

Co-authored-by: Charles Bochet <[email protected]>
abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 19, 2025
…wentyhq#12711)

Why : we had an issue impoting events du to CalendarEvents not yet
existing while inserting the CalendarChannelAssociation due to inverted
method in the service

This PR refactors the calendar event import logic by 
- renaming 
- splitting utility functions for better clarity and maintainability. 
- adding TSDoc comments to explain the purpose and uniqueness of the
`eventExternalId` field in calendar event associations


Fixes twentyhq#12690

---------

Co-authored-by: Charles Bochet <[email protected]>
ijreilly pushed a commit that referenced this pull request Jun 19, 2025
…12711)

Why : we had an issue impoting events du to CalendarEvents not yet
existing while inserting the CalendarChannelAssociation due to inverted
method in the service

This PR refactors the calendar event import logic by 
- renaming 
- splitting utility functions for better clarity and maintainability. 
- adding TSDoc comments to explain the purpose and uniqueness of the
`eventExternalId` field in calendar event associations


Fixes #12690

---------

Co-authored-by: Charles Bochet <[email protected]>
@guillim guillim moved this from 🔦 In QA to ✅ Done in 🎯 Roadmap & Sprints Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Error: Unknown error importing calendar events... [reafcto required]
3 participants