I'm currently working on a project where I need to handle data transformation from raw HTTP objects to UserDTO objects, then to simple objects, and finally to Mongoose objects using their respective interfaces. However, I'm finding it challenging to handle these objects correctly and ensure they are tightly coupled.
The documentation I've come across shows the two sides (DTO objects and Mongoose models) separately, but not how to integrate them properly. I have a few specific questions:
- Should I use the instanceToPlain function to handle the transformation between objects?
- What is the best approach for converting objects into different interfaces?
- Is it necessary to transform the objects back to simple objects with a predefined interface before creating a Mongoose document?
I would appreciate any guidance or best practices on how to handle the integration of DTO objects and Mongoose models effectively, as well as any recommendations on how to properly convert objects between different interfaces.
Formatter by ChatGPT.
Regards, Victor.
will stop you from using a typing like a dto as a value