I think it's important to know what DTO is.
DTO(Data Transfer Object) is a concept of Java(J2EE) design.
It looks like a normal Java Bean object, which was created for transferring data object through multiple layers (such as controller, service, database) in our backend, especially in Distributed Systems.
With DTO Model:-
It helps us to handle our data object.
In the guide of NestJS, DTO acts like a HTTP Request body.
In my opinion, DTO contains:
some attributes we would use but not in Database.
and DTO masks:
some attributes we don't want to expose.
To use with class-validator, DTO can also help us validate data in an elegant way.
Sometimes it looks same with object interface.
I think DTO matters when our database collection is huge and complex.