Drying things up?
I noticed a lot of repetition (maybe this is just a cqrs thing), and I can understand that some is justified, but for example closedAt is defined 14 times across different objects/types https://github.com/kyhsa93/nestjs-rest-cqrs-example/search?q=closedAt
So my question is this, can you think of any way to dry up your CQRS pattern?
Thanks
@RobertLowe I am also very concerned about it. I thought that it could be solved by inheriting the domain class, but it didn't work as expected. If you have any good ideas, please help. thank you.
I just wanted to write the same thing. I don't think it is necessary to re-define new interfaces every time I work with an account. For example, why would I define a new interface here when I can just use the domain model? 🤔
https://github.com/kyhsa93/nestjs-rest-cqrs-example/blob/master/src/accounts/application/queries/account.query.ts#L1
And there are other places like for example AccountFactory these methods are basically the same? 🤔
create(id: string, name: string): Account {
return this.eventPublisher.mergeObjectContext(
new AccountImplement({ id, name }),
);
}
reconstitute(properties: AccountProperties): Account {
return this.eventPublisher.mergeObjectContext(
new AccountImplement(properties),
);
}
Message to comment on stale issues. If none provided, will not mark issues stale