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

Assimilate Event Sourcing functionality into regular aggregates #447

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

subhashb
Copy link
Contributor

So far, Event Sourced Aggregate was a segarate domain element with its own class and factory. This causes a few issues:

  • A separate API for event sourced aggregates
  • Duplication of code between aggregate types
  • When a bug is fixed in one place, the other has to be take care too
  • Dissimilarities in functionality (Event sourced aggregates did not support invariants and entity nesting)

This commit merges the functionality and introduces an option called is_event_sourced on BaseAggregate to control event sourcing behavior. The repository will remain as-is for now, because that's where event sourced aggregates primarily differ from regular aggregates. This will need to be revisited if we want to support custom event sourced repositories.

So far, Event Sourced Aggregate was a segarate domain element with its own class
and factory. This causes a few issues:
- A separate API for event sourced aggregates
- Duplication of code between aggregate types
- When a bug is fixed in one place, the other has to be take care too
- Dissimilarities in functionality (Event sourced aggregates did not support invariants
  and entity nesting)

This commit merges the functionality and introduces an option called `is_event_sourced`
on BaseAggregate to control event sourcing behavior. The repository will remain as-is
for now, because that's where event sourced aggregates primarily differ from regular
aggregates. This will need to be revisited if we want to support custom event sourced
repositories.
@subhashb subhashb self-assigned this Jul 19, 2024
Copy link

codecov bot commented Jul 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.14%. Comparing base (efb2635) to head (8193954).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #447      +/-   ##
==========================================
+ Coverage   88.92%   89.14%   +0.21%     
==========================================
  Files          72       71       -1     
  Lines        6013     5959      -54     
  Branches     1201     1198       -3     
==========================================
- Hits         5347     5312      -35     
+ Misses        495      479      -16     
+ Partials      171      168       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

subhashb added 3 commits July 19, 2024 13:51
Event sourced aggregates so far were only limited to on aggregate, with no support
for underlying entities. This commit allows event sourced aggregates to behave
just like regular aggregates with multi-level heirarchies.
@subhashb subhashb merged commit 13acb55 into main Jul 19, 2024
6 checks passed
@subhashb subhashb deleted the event-sourced-aggregate-assimilation branch July 19, 2024 23:46
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