Hi all 👋🏼 !
Simple architecture question : where do you process your DTOs before creating / saving them into the database ?
The fact is, my DTO doesn't have the same structure as the targeted Schema. So, I have two questions : where and how ?
Where : I don't know if I need to transform my DTO right when it arrives into the controller (so through a Pipe), or right before the save function in my repository. To my mind, it's better to pass the DTO structure until it reaches the repository. Right ?
How : My DTO doesn't have the same structure as the targeted schema. For example, the same field in my DTO can be a string, but an object in my schema (because I want my DTO to be the simplest possible). I have no other idea than creating a mapper which will take the DTO and produce the desired Schema thanks to some logic and with plainToClass.
I'm a bit lost there, what's your advice ? Thanks for your help again and have a great day.