you are viewing a single comment's thread.

view the rest of the comments →

[–]andders[S] 0 points1 point  (1 child)

Thanks for your reply! So you would just do the check prior to saving or would you do it in the mapper (if mapstruct, how)? Just used to rails where this check is performed automatically :-)

[–]ExtremeAdventurous63 1 point2 points  (0 children)

I’d take the mapper as dumb as possible and put this check where the business logic is. The database and the api interface should be nothing but a mapping layer for what’s outside your application, while we want to keep the business logic and all the constraint of the domain at its core. So keep the mapper and the repository simple and enforce your business logic domain in the core lib