I have been using the Java Spring framework for developing Microservices. Recently I started exploring NestJS and have a question regarding building response DTOs.
In Spring, The controllers are lightweight, they hand over the call to Service Layer.
The service layer implements the business logic, and finally, they call the Mapper classes that are responsible for building the response DTOs. The mapper class might be as simple as cloning the entity to a DTO or might also build complex objects using multiple DB entity objects.
In NestJS, in most of the examples class-transformer is being used. But I am not sure the class-transformer is good enough for building complex objects. For me class-transformer is basically cloning the object. The equivalent for which in Spring is
BeanUtils.copyProperties(workingWellCompositeMemberContactTrace, workingWellDailyMemberAggEntity);
So my question is in NestJS, what layer is responsible for building complex response objects? And Is sending Entity object to Controller a good practice?
