I'm building a micro-service API, and breaking down an existing stored procedure and moving some logic into the API (the stored procedure is too big and we cannot do the unit test on it properly).
For the micro-service API, we are using controller, service and repository pattern but unsure where some of the logic should go.
- Trimming phone number for storing into the database, and other data preparation
- Moving default validation logic from the stored procedure to C# (e.g. if the
sortExpressionis invalid we set it the variable to
For both, I'm currently putting it in the service layer.
For (2), is it ok to do this kind of logic in C#?
I did some research, and they all say business logic should go to service but does this count as business logic? It's more like data preparation and validation for the database