C
C#2y ago
bookuha

❔ CRUD(REST) + DDD

Hi, I’m developing a simple CRUD messenger and trying to also have it DDD’ed. The problem is that the interaction interface is REST, and I want to update a specific message content/recipient/color. By terms of DDD I could simply get some domain services, aggregates with this logic injected or value objects and simply call the ChangeMessageColor(Message) method. But REST, the way I understand it, makes me expose a single PUT message/id endpoint, that will receive any changes to the resource
3 Replies
bookuha
bookuhaOP2y ago
There are some ways I see to handle this: 1) Change entity using JsonPatch, then run a domain validator on it (looks very bad) 2) Define EntityDomainService.Update() & Entity.Update() methods that will validate any changes that happen 3) In Application Service figure our what properties have changed, then call related Entity.UpdatePropertyName1(), UpdatePropertyName2() methods 3) looks the most correct yet the most difficult way and I have never seen anything like that before 1) looks simple and working, but not so expressive How would you handle this kind of logic?
bookuha
bookuhaOP2y ago
GitHub
eShopOnWeb/UpdateCatalogItemEndpoint.cs at main · dotnet-architectu...
Sample ASP.NET Core 6.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder. - eS...
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server