fase(1): shared domain building blocks
This commit is contained in:
22
dist/shared/domain/AggregateRoot.js
vendored
Normal file
22
dist/shared/domain/AggregateRoot.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AggregateRoot = void 0;
|
||||
const Entity_1 = require("./Entity");
|
||||
class AggregateRoot extends Entity_1.Entity {
|
||||
constructor(props, id) {
|
||||
super(props, id);
|
||||
this._domainEvents = [];
|
||||
}
|
||||
get domainEvents() {
|
||||
return this._domainEvents;
|
||||
}
|
||||
addDomainEvent(event) {
|
||||
this._domainEvents.push(event);
|
||||
}
|
||||
clearEvents() {
|
||||
const events = [...this._domainEvents];
|
||||
this._domainEvents = [];
|
||||
return events;
|
||||
}
|
||||
}
|
||||
exports.AggregateRoot = AggregateRoot;
|
||||
Reference in New Issue
Block a user