Hi everyone!
I make the video to summarize the "DTO" concept because if this is the first time you see the DTO
pattern
You will confuse a lot, I know.
So for that reason I will build this video, right?
And for now let's understand.
The client and server.
And client in this case will be the "postman", right?.
And in the postman I will send the request into the server.
I will send using the "DTO".
Okay "DTO".
I send "DTO" and it will send to the server.
Right?
It sends the DTO into the server.
And with this information with this "DTO" from the client right now, the server will take the information
and go to the database and process it and create for me the entity.
This is a real entity into the database, right?
And from this entity right here, the server will convert it inside the "DTO" also, this's "DTO Response"
And it will send into the client.
That's what happened right now, you can see.
If I remove everything go to the post controller right here.
We take the create post dto from the client right.
And we pass it into the server or the service.
And inside the service we will process that.
We already create the entity, right?
The post right here is the real.
The real entity.
And from the real entity right here, we convert it back the DTO.
And from the DTO we will respond it to client.
That's the what happend right now, and I hope you understand more and more about "DTO" pattern
right here.
It's very useful because we already removed, we already reduced the amount of data.
Right.
And we also do the validation directly inside the DTO.
And we already keep this schema simple as it can.
Actually we can easily use the the some validation rule directly inside the schema.
But we not do that right.
So for that reason make sure we keep the schema.
Simple as it can, and move on validation logic into the createDTO.
That's the whole point of understand "DTO"
And that's what happened right now.
So I hope you understand this video.
If not, don't worry about that.
We will progress more and more.
If you continue with this course.
I will see you in the next one.