WEBVTT

1
00:00.830 --> 00:02.540
Hi everyone!

2
00:04.400 --> 00:16.220
I make the video to summarize the "DTO" concept because if this is the first time you see the DTO

3
00:16.220 --> 00:16.910
pattern

4
00:18.950 --> 00:22.040
You will confuse a lot, I know.

5
00:22.370 --> 00:27.380
So for that reason I will build this video, right?

6
00:27.710 --> 00:29.960
And for now let's understand.

7
00:32.510 --> 00:33.890
The client and server.

8
00:36.860 --> 00:40.610
And client in this case will be the "postman", right?.

9
00:40.760 --> 00:45.650
And in the postman I will send the request into the server.

10
00:46.280 --> 00:49.040
I will send using the "DTO".

11
00:50.000 --> 00:51.170
Okay "DTO".

12
00:53.870 --> 00:57.560
I send "DTO" and it will send to the server.

13
00:57.590 --> 00:58.220
Right?

14
00:58.310 --> 01:00.440
It sends the DTO into the server.

15
01:00.440 --> 01:14.750
And with this information with this "DTO" from the client right now, the server will take the information

16
01:14.750 --> 01:21.650
and go to the database and process it and create for me the entity.

17
01:23.990 --> 01:28.100
This is a real entity into the database, right?

18
01:28.130 --> 01:40.040
And from this entity right here, the server will convert it inside the "DTO" also, this's "DTO Response"

19
01:42.800 --> 01:45.080
And it will send into the client.

20
01:45.770 --> 01:48.920
That's what happened right now, you can see.

21
01:51.710 --> 01:57.110
If I remove everything go to the post controller right here.

22
01:57.110 --> 02:02.180
We take the create post dto from the client right.

23
02:02.180 --> 02:06.320
And we pass it into the server or the service.

24
02:07.340 --> 02:09.680
And inside the service we will process that.

25
02:09.710 --> 02:13.160
We already create the entity, right?

26
02:13.190 --> 02:14.900
The post right here is the real.

27
02:16.670 --> 02:17.630
The real entity.

28
02:19.730 --> 02:25.400
And from the real entity right here, we convert it back the DTO.

29
02:26.960 --> 02:32.690
And from the DTO we will respond it to client.

30
02:33.710 --> 02:41.730
That's the what happend right now, and I hope you understand more and more about "DTO" pattern

31
02:41.730 --> 02:42.180
right here.

32
02:42.180 --> 02:51.060
It's very useful because we already removed, we already reduced the amount of data.

33
02:51.090 --> 02:51.720
Right.

34
02:51.750 --> 02:56.850
And we also do the validation directly inside the DTO.

35
02:57.330 --> 03:03.510
And we already keep this schema simple as it can.

36
03:03.720 --> 03:12.900
Actually we can easily use the the some validation rule directly inside the schema.

37
03:12.930 --> 03:14.850
But we not do that right.

38
03:15.420 --> 03:19.590
So for that reason make sure we keep the schema.

39
03:21.870 --> 03:30.420
Simple as it can, and move on validation logic into the createDTO.

40
03:31.350 --> 03:35.220
That's the whole point of understand "DTO"

41
03:36.150 --> 03:38.190
And that's what happened right now.

42
03:39.090 --> 03:41.820
So I hope you understand this video.

43
03:41.850 --> 03:43.920
If not, don't worry about that.

44
03:43.920 --> 03:46.980
We will progress more and more.

45
03:48.060 --> 03:50.250
If you continue with this course.

46
03:51.180 --> 03:52.830
I will see you in the next one.