hello,
I've been looking for something related for a few weeks, but I'm not convinced.
I'm making a RestAPI. And, I know about the DTO.
First, look at the picture above.
The red picture is the part I drew.
Except for the red part, DTO is only mentioned between Controller-Service.
That is, the problem mentions the necessity of using DTO only between Controller-Serve in the example that explains most of the DTO.
But if you dig a little deeper, someone View(Front) - You mention that you need a "separate" DTO used by the Controller.
That means we already need two separate DTOs.
Then next, Now someone says that DTO should be broken down into RequestDTO and ResponseDTO.
Then I have a ControllerRequestDTO that needs to be passed from View to Controller
ServiceRequestDTO that should be passed from Controller to Service
After that, it is transformed into an Entity and after work is done, the returned Entity must be converted into a DTO.
So, ServiceResponseDTO created in Service and passed to Controller
ControllerResponseDTO that should be sent back from Controller to View
I understood that it should be composed of .
But once again, there is very little information about the DTO required by the View-Controller.
ControllerRequestDTO, ControllerResponseDTO, ServiceRequestDTO, ServiceResposeDTO
4 in total.
Am I making it right?
Or are you increasing unnecessary resources?