Skip to content
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

feat: validate entity and event aggregate_id value and type #80

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

lukashlavacka
Copy link
Contributor

Why

Eventsimple requires both event and entity to specify entity column used as aggregate_id in the event. This provides flexibility to use different attribute than primary key to connect event to the entity class.

It's possible to accidentally set different value for this attribute. This does not break Eventsimple behaviour, but it introduces unpredictable behaviour when reading event history.

It's also possible to accidentally set different type on event.aggregate_id column that does not support entity aggregate value type. This breaks Eventsimple behaviour as events cannot be inserted into database.

What changed

We added validation that aggregate_id argument value and column type matches between event and entity.

Copy link
Collaborator

@desheikh desheikh left a comment

Choose a reason for hiding this comment

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

Thanks for adding this @lukashlavacka 🙏

@desheikh desheikh force-pushed the derive-aggregate_id branch 3 times, most recently from fc6afcd to 4b7ed1c Compare December 23, 2024 19:46
@desheikh desheikh force-pushed the derive-aggregate_id branch from 4b7ed1c to e76b534 Compare December 31, 2024 21:04
@desheikh desheikh merged commit e006a61 into main Jan 2, 2025
8 checks passed
@desheikh desheikh deleted the derive-aggregate_id branch January 2, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants