Skip to content

Commit c90bccd

Browse files
committed
Add aggregate root core class
1 parent 698bea4 commit c90bccd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/shared/core/AggregateRoot.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
interface AggregateObjectProps {
2+
[index: string]: any;
3+
}
4+
5+
export abstract class AggregateRoot<T extends AggregateObjectProps> {
6+
public props: T;
7+
protected readonly _id: number;
8+
9+
protected constructor(props: T, id: number) {
10+
this.props = { ...props };
11+
this._id = id;
12+
}
13+
14+
get id(): number {
15+
return this._id;
16+
}
17+
}

0 commit comments

Comments
 (0)