Skip to content

Instantly share code, notes, and snippets.

@leegilmorecode
Last active December 3, 2022 04:34
Show Gist options
  • Save leegilmorecode/2562e1d3c7a5003067b46e0d46ffb31b to your computer and use it in GitHub Desktop.
Save leegilmorecode/2562e1d3c7a5003067b46e0d46ffb31b to your computer and use it in GitHub Desktop.
Example aggregate root abstract base entity
import { DomainEvent } from './domain-event';
import { Entity } from './entity';
// denotes visually that this entity is the aggregate root
// and stores the overall domain events for publishing
export abstract class AggregateRoot<T> extends Entity<T> {
// aggregates which implement this must create this method
// to consolidate events from the full aggrgate root and children
abstract retrieveDomainEvents(): DomainEvent[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment