You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would you share the validation logic between the Create and Update methods on the CustomerController if you needed to check for name, email and email validation uniqueness on both methods? Would a private method be sufficient? What if that logic needed to be shared somewhere else?
The text was updated successfully, but these errors were encountered:
If it's just 2 places (create and update), I usually don't bother to gather this logic into a single spot, just duplicate the uniqueness validation. If becomes needed somewhere else -- look at why. If it's a totally unrelated API endpoint, then duplicate it there too. If it's something related to customer creation/update, then add a domain service and move that logic there (though most likely, you'd need to move more than just uniqueness validation).
How would you share the validation logic between the Create and Update methods on the CustomerController if you needed to check for name, email and email validation uniqueness on both methods? Would a private method be sufficient? What if that logic needed to be shared somewhere else?
The text was updated successfully, but these errors were encountered: