WEBVTT

00:00.480 --> 00:02.200
Hi everyone.

00:02.200 --> 00:07.040
In this video, let's get on the bus.

00:07.520 --> 00:18.200
Okay, but before that, in previous video, I completely forgot to put the user or the author over

00:18.200 --> 00:25.080
here right now when we create a post, let me show you.

00:43.880 --> 00:50.120
You can say we don't have the author property over here, right?

00:50.720 --> 00:57.320
So in this video let's try to fix that inside the controller.

00:57.840 --> 01:05.320
If you remember we already built the that I forget the current users, right?

01:14.800 --> 01:19.200
And I will pass it right here inside the query method.

01:20.840 --> 01:21.640
Let us.

01:24.000 --> 01:33.360
And we need to this chapter in this thing and without our property we will put the current user over

01:33.360 --> 01:33.720
here.

01:42.200 --> 01:44.120
So let me say it again.

01:50.440 --> 01:51.680
Go to the database.

02:01.760 --> 02:06.640
And this already only half the author's property, right?

02:07.600 --> 02:11.800
Well, in order to file on it.

02:11.800 --> 02:12.520
Very easy.

02:12.920 --> 02:17.720
We just need to use this plot box.

02:17.720 --> 02:18.920
Model file.

02:26.320 --> 02:28.520
Let me duplicate.

02:32.480 --> 02:36.760
And get all users a box.

02:37.960 --> 02:45.000
We already have, uh, access token and chain method to get.

02:47.640 --> 02:59.120
Let me say right here, we already got the entire thing, but it just not good at all.

02:59.160 --> 02:59.800
The reason?

02:59.800 --> 03:03.000
Because right here, we don't have ability to know.

03:03.600 --> 03:07.520
The bus over here belongs to what?

03:07.520 --> 03:08.200
Users?

03:08.240 --> 03:11.600
Okay, so how we can do that?

03:12.440 --> 03:19.880
Well, let's see what the results we will expect.

03:20.200 --> 03:26.600
Well, I expect it will have a something in here.

03:26.960 --> 03:31.000
Well, firstly we read our ID okay.

03:31.520 --> 03:34.920
And the second one will be our name.

03:37.800 --> 03:39.480
And email.

03:40.360 --> 03:42.800
And later for example we have an avatar.

03:43.280 --> 03:45.880
We will use our avatar over here.

03:46.480 --> 03:47.000
Okay.

03:47.800 --> 03:52.560
But right now I want it will add a little bit of custom property.

03:53.440 --> 03:57.640
Well, if you boost like this let me show you.

03:59.920 --> 04:01.400
This is a custom property.

04:08.240 --> 04:17.840
The reason is the customer update, because if you remember with all updates it will have inside a postman.

04:17.840 --> 04:21.840
You can see it is exactly the same with the property, right?

04:22.360 --> 04:32.120
But inside the database we don't have the author ID fields or author name authors email.

04:32.120 --> 04:33.560
We don't have that right.

04:33.800 --> 04:37.360
For that reason we will call this thing will be custom property.

04:39.200 --> 04:44.800
And let me say, well, first of all, it will not work at all.

04:48.680 --> 04:49.920
Can you guess why?

04:52.240 --> 04:56.760
Well, the reason is simple because this is the custom property.

04:57.320 --> 05:04.280
For that reason, we need to somehow customize the response of the detail.

05:04.760 --> 05:11.200
Well, how to do dust in the cloud transformer package.

05:11.680 --> 05:12.760
We have a.

05:12.800 --> 05:22.840
One more decorator will be transformed from class transformers inside.

05:22.840 --> 05:30.320
Here we will take a look at the object and I will console.log object for you.

05:32.000 --> 05:36.320
So you will wrap it inside the object or directly destructuring.

05:37.240 --> 05:38.760
And let me show you.

05:42.400 --> 05:51.000
Let me say well if you look at right here we have the outer right.

05:51.040 --> 05:52.080
We have outer.

05:52.120 --> 06:01.720
It means this will console.log the original object from the response over here okay.

06:01.720 --> 06:07.250
When it respond result, it will take a look directly inside the Insert object.

06:07.810 --> 06:14.090
So with this guy we can popularize with the options.

06:14.130 --> 06:25.330
Okay, we like the outdoors because in insert the schema we add the outer property.

06:26.250 --> 06:29.450
Now let's say what is the response right now.

06:33.570 --> 06:34.490
Well you can say it.

06:34.490 --> 06:36.170
Auto destruct three.

06:36.730 --> 06:40.610
Sorry it already populates the outer right.

06:41.490 --> 06:46.650
With this thing we can return directly the object dot.

06:50.610 --> 06:50.970
Name.

06:52.770 --> 06:57.290
Sorry, this is the ID of the result we will update.

06:58.890 --> 07:02.930
And later by and right here we dot name.

07:03.490 --> 07:03.930
Sorry.

07:04.490 --> 07:07.770
Here we object okay.

07:08.370 --> 07:09.490
This is the object.

07:10.090 --> 07:12.130
This is the next object, right?

07:37.370 --> 07:41.970
And also we will fix the TypeScript.

07:43.490 --> 07:53.290
Right now let me say uh, we got the internal server error we cannot reach from the uploaded file.

07:56.050 --> 08:00.410
Can you guess why we have the error?

08:00.850 --> 08:04.010
Cannot read property of undefined.

08:04.730 --> 08:11.050
Well, the reason is simple, but I will show you how we can debug that fully.

08:11.050 --> 08:14.170
I will console.log the object again.

08:16.370 --> 08:24.490
And I will say if I say you can say right here we have one more property.

08:26.050 --> 08:28.130
We have one more document.

08:28.130 --> 08:32.410
I don't have the author, right.

08:32.690 --> 08:39.610
So for that reason let's check the database and let's drop the collection.

08:39.610 --> 08:45.690
Or you can drop entirely and recreate us again.

08:56.810 --> 08:58.010
Let me go up.

09:09.650 --> 09:10.050
Here.

09:17.250 --> 09:17.810
Okay.

09:28.330 --> 09:31.010
And let me get old, boss.

09:33.210 --> 09:35.250
Now, you can say when we get old, boss.

09:35.290 --> 09:38.930
We already have our name and our emails.

09:39.250 --> 09:42.370
Okay, so that's what we want.

09:42.410 --> 09:44.490
Let me create again.

09:48.290 --> 09:51.210
And one more thing you can remember.

09:53.530 --> 10:00.410
In order to create a boss, we don't need the author name or author email.

10:00.770 --> 10:01.250
Okay.

10:01.730 --> 10:04.290
We don't need that at all for that reason.

10:04.890 --> 10:14.370
We don't need to populate us, but in order to populate inside, get inside the box method.

10:15.290 --> 10:16.650
What do you want?

10:17.410 --> 10:23.690
Of course we can try to get that and populate that and return the new data right here.

10:24.050 --> 10:28.410
But I think that's not what we want okay.

10:28.450 --> 10:34.490
We only want to create because we don't care about the response right here okay.

10:34.850 --> 10:36.570
We don't care the response right here.

10:36.810 --> 10:40.210
So for that reason this will be very enough.

10:41.770 --> 10:46.450
But when we get we will for sure because we already mobilized.

10:46.450 --> 10:46.970
Right.

10:47.290 --> 10:51.730
So for that reason we will go now the name and email.

10:58.170 --> 10:59.730
So that's about us.

11:01.090 --> 11:07.610
And right here for more detail we can boost the a bit of checking.

11:13.770 --> 11:19.170
And fitness on bass Rock, right?

11:19.610 --> 11:20.330
Right here.

11:21.290 --> 11:26.810
Let me put the some task with the object right here.

11:27.610 --> 11:29.530
Railway boss.

11:33.570 --> 11:34.090
Right.

11:39.090 --> 11:39.570
Okay.

11:39.570 --> 11:42.130
This will fix that issue.

11:46.010 --> 11:47.170
So listen again.

11:48.010 --> 11:48.450
Okay.

11:48.450 --> 11:50.050
It's already work.

11:50.770 --> 11:53.210
And you can see we have a list of problem.

11:53.490 --> 11:58.690
When we retrieve the data, the ID right here will change.

11:59.050 --> 12:03.410
The reason it change when we send.

12:03.450 --> 12:08.170
Because right here we know it's exposed correctly.

12:08.650 --> 12:12.690
So in the next video I will show you how we can fix that issue.
