Skip to content

Commit

Permalink
Add aggregate root core class
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejkang committed Aug 12, 2021
1 parent 698bea4 commit c90bccd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/shared/core/AggregateRoot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
interface AggregateObjectProps {
[index: string]: any;
}

export abstract class AggregateRoot<T extends AggregateObjectProps> {
public props: T;
protected readonly _id: number;

protected constructor(props: T, id: number) {
this.props = { ...props };
this._id = id;
}

get id(): number {
return this._id;
}
}

0 comments on commit c90bccd

Please sign in to comment.