@arpinum/backend
Version:
Base modules for backend applications
23 lines (17 loc) • 354 B
JavaScript
;
let _ = require('lodash');
class Event {
constructor(type, data) {
this.date = new Date();
this.type = type;
this.data = _.clone(data) || {};
}
concerningAggregate(aggregate) {
this.aggregate = {
name: aggregate.constructor.name,
id: aggregate.id
};
return this;
}
}
module.exports = Event;