WEBVTT

00:01.680 --> 00:03.160
Hi everyone!

00:03.680 --> 00:15.520
After we already have a Send request and cancel a request, we will create a method for accept request.

00:15.560 --> 00:18.000
Okay, so let me create.

00:20.960 --> 00:22.920
Accept request.

00:27.000 --> 00:27.680
Right here.

00:28.560 --> 00:33.800
In here we need to mark the request ID okay.

00:33.800 --> 00:35.360
With this string over here.

00:39.560 --> 00:43.040
I will call friend request okay.

00:43.560 --> 00:48.520
And inside the controller I will create the makeup.

00:48.520 --> 00:51.040
Everything over here.

00:56.040 --> 00:58.360
Accept friend request.

00:59.470 --> 01:01.110
And right here will be accept.

01:03.430 --> 01:03.950
Request.

01:03.990 --> 01:04.510
Right.

01:05.350 --> 01:08.670
And we need to vote the friend request.

01:17.870 --> 01:18.910
Over and over here.

01:19.310 --> 01:20.270
The friend request.

01:21.550 --> 01:22.030
And.

01:24.270 --> 01:25.830
Rename the method over here.

01:31.590 --> 01:33.870
We need the current user also.

01:42.150 --> 01:42.710
Right.

01:47.670 --> 01:50.230
And India only.

01:50.230 --> 01:57.610
We need to find the request by this ID over here.

02:13.530 --> 02:14.050
Okay.

02:14.730 --> 02:15.570
And right here.

02:15.570 --> 02:16.290
We need to check.

02:16.290 --> 02:25.850
If we don't have a friend request, I would allow new node file.

02:26.530 --> 02:28.450
Essentially correct.

02:28.490 --> 02:29.250
Node file.

02:34.250 --> 02:34.770
Okay.

02:35.970 --> 02:38.610
And after that we need to check one more thing.

02:38.610 --> 02:43.330
We will need friend request dot state dot.

02:44.090 --> 02:44.810
If it.

02:48.290 --> 02:54.810
Is not appended we will throw the request exception also.

03:01.040 --> 03:02.640
Uh, I will call.

03:06.080 --> 03:06.760
Incorrect.

03:06.800 --> 03:09.080
Only I know.

03:10.560 --> 03:11.080
Okay.

03:12.240 --> 03:17.280
We only accept if the friend request is pending.

03:17.320 --> 03:17.640
Okay.

03:17.680 --> 03:24.200
We cannot accept if this here will be, uh, accept or reject.

03:24.240 --> 03:24.720
Okay.

03:26.720 --> 03:30.240
After that, we need to check one more thing.

03:31.000 --> 03:34.880
Let me show you if the current user dot underscore id.

03:38.520 --> 03:39.840
Different with, uh.

03:42.000 --> 03:44.480
The friend request.

03:45.680 --> 03:46.160
Dot.

03:50.640 --> 03:51.800
Receiver.

03:54.660 --> 03:58.740
We are not on the street.

04:00.500 --> 04:02.100
We will throw the error.

04:02.260 --> 04:03.420
Let me show you why.

04:06.460 --> 04:06.860
My way.

04:06.860 --> 04:09.620
I will throw some error.

04:10.020 --> 04:10.580
The reason?

04:10.580 --> 04:18.420
Because it lights up when I send a request to be okay.

04:18.780 --> 04:20.300
It means right here.

04:20.340 --> 04:26.820
In order to accept the request from A to B, we should log in at B account.

04:26.860 --> 04:27.220
Right?

04:27.260 --> 04:31.980
We should log in with B account to accept the A request.

04:32.620 --> 04:33.140
Right.

04:33.700 --> 04:39.020
And for that reason the current user right here will be the B account okay.

04:39.460 --> 04:45.660
And from here we need to to look up the receiver ID okay.

04:45.740 --> 04:46.940
Receiver array.

04:46.980 --> 04:49.780
In this case first of all will be the base okay.

04:50.180 --> 04:53.200
It means if the base is not.

04:53.200 --> 04:54.560
Are we okay?

04:54.960 --> 04:57.600
We will throw the batch request exception.

04:57.800 --> 04:58.200
Okay.

04:58.240 --> 04:59.160
That's the idea.

05:03.560 --> 05:04.000
And.

05:05.440 --> 05:10.760
Okay, I hope you understand this right here.

05:10.760 --> 05:14.960
I think the best way I can remove the parameter.

05:15.640 --> 05:16.120
Okay.

05:16.360 --> 05:21.080
And we don't need to put any message over here, okay.

05:21.080 --> 05:25.600
We need to automate object in over here.

05:26.560 --> 05:33.440
And after that we will update the status from friend request right here.

05:34.120 --> 05:41.080
Status will be asset and Maxwell with saved into the database.

05:44.760 --> 05:45.280
Okay.

05:46.680 --> 05:51.510
After we saved into the database we should To boost.

05:54.750 --> 05:57.030
The schema over here.

05:57.070 --> 05:58.190
Right over here.

05:58.550 --> 05:59.070
Right.

06:02.790 --> 06:04.550
We sort of right over here.

06:04.950 --> 06:09.990
Let me add a little bit of the file will be an empty array over here.

06:10.710 --> 06:11.190
Okay.

06:11.910 --> 06:13.030
Right here we do.

06:14.470 --> 06:18.190
Let me show you right here.

06:18.190 --> 06:19.030
We need to.

06:22.070 --> 06:23.510
Inject the user.

06:23.910 --> 06:24.470
Right.

06:26.990 --> 06:27.510
Right here.

06:27.510 --> 06:28.510
We already have a user.

06:28.510 --> 06:31.030
So let me open a user survey.

06:31.470 --> 06:33.750
And we need to write a little bit of code.

06:36.470 --> 06:36.910
Right.

06:37.350 --> 06:47.030
Right here I will add right okay I will create a function add friend.

06:49.220 --> 07:05.300
And right here we need to put the user ID the user ID here to find what is the user we want to add three.

07:08.180 --> 07:08.940
Straight.

07:13.940 --> 07:16.020
Right and right.

07:17.700 --> 07:18.060
So.

07:23.020 --> 07:32.580
And right here let me say um we can call.

07:35.220 --> 07:42.220
This dot user model dot update one.

07:45.860 --> 07:48.160
Uh we can put a little bit over here.

07:53.280 --> 07:53.760
Well, I.

07:57.560 --> 08:00.560
Uh, I think we got that.

08:07.080 --> 08:11.600
We are going to update the user ID over here.

08:12.400 --> 08:17.880
And in here we can use add or set operator.

08:18.800 --> 08:21.400
And we need to put the fluoride.

08:27.120 --> 08:28.640
With the fluoride over here.

08:28.960 --> 08:29.480
Right.

08:37.120 --> 08:43.680
So that is we saw with this operator we will.

08:44.200 --> 08:48.100
It's similar Similarly with the boost method from JavaScript.

08:48.140 --> 08:48.540
Okay.

08:48.900 --> 08:55.700
It will find the array in the front row here, and it will perform the boost with the operator.

08:58.700 --> 09:03.060
Okay, that that shot is okay.

09:03.100 --> 09:04.420
I hope you understand.

09:04.740 --> 09:10.820
And right here let me say after here we will append us into the user.

09:11.460 --> 09:11.980
Right.

09:12.940 --> 09:16.420
We need to move that into the user.

09:20.180 --> 09:26.140
Dot user service dot frame one frame.

09:26.580 --> 09:29.380
So this is what user we want to add right.

09:29.900 --> 09:33.980
The user right here we will come from the current user.

09:34.820 --> 09:35.140
Okay.

09:35.140 --> 09:42.340
We can move or we can look at the frame request dot center.

09:45.050 --> 09:46.690
And foreign aid.

09:55.290 --> 09:59.650
Will come from the friend request, not the receiver.

10:05.530 --> 10:05.970
And?

10:10.210 --> 10:10.970
Right here.

10:11.010 --> 10:13.250
Let me call the toString.

10:15.610 --> 10:17.010
And here we will say.

10:21.770 --> 10:22.330
Okay.

10:22.330 --> 10:29.770
And we need to duplicate to the opposite side receiver and sender okay.

10:29.810 --> 10:37.250
So what happened right now we need to add for example the I the I send the request to B and the way.

10:37.250 --> 10:38.850
Will we accept that okay.

10:39.170 --> 10:44.630
It means we want to put the that I will have a friend.

10:47.230 --> 10:48.430
Wait, okay.

10:48.830 --> 10:50.150
And be right here.

10:50.590 --> 10:53.150
We will also have a frame I.

10:57.670 --> 10:58.270
Okay.

10:58.390 --> 11:00.990
That's what we need to do right here.

11:01.470 --> 11:04.950
Firstly, we will add the frame into the sender.

11:05.110 --> 11:07.550
The sender in this case will be the I right.

11:07.750 --> 11:12.350
And we also add the frame into the receiver okay.

11:12.390 --> 11:14.430
In this case will be the base.

11:14.950 --> 11:17.350
And that is okay.

11:17.390 --> 11:18.950
So I hope you understand.

11:20.190 --> 11:26.110
And let's start go to the user controller.

11:26.150 --> 11:26.550
Sorry.

11:26.590 --> 11:31.070
Go to the frame controller accept request.

11:33.470 --> 11:35.150
Let me rename right here.

11:53.980 --> 11:54.580
Okay.

11:58.420 --> 12:01.220
Right now I will send a friend request.

12:01.540 --> 12:13.060
Let me say, after we have ended up with this idea over here and that is the accept request, come with

12:13.060 --> 12:14.540
ID over here.

12:14.820 --> 12:18.980
And let's say, uh, we have a forbidden.

12:18.980 --> 12:19.300
Okay.

12:19.660 --> 12:28.420
Forbidden because you can say right here, we already logged in with the account I.

12:28.820 --> 12:30.940
So for that reason.

12:36.380 --> 12:39.930
We should log in with the receiver over here.

12:39.970 --> 12:40.410
Right.

12:41.410 --> 12:44.850
Let me sign in with this account.

12:46.970 --> 12:47.730
Right away.

12:49.850 --> 12:50.730
Moreover, he.

12:53.370 --> 12:56.050
Said okay.

12:59.970 --> 13:01.930
Let me upload it to the users.

13:06.730 --> 13:07.450
With a friend.

13:07.490 --> 13:12.090
We already have the object with this friend, right?

13:12.570 --> 13:13.290
You can say.

13:13.770 --> 13:18.090
And from this friend over here will fly back to this idea.

13:18.090 --> 13:18.690
Over here.

13:19.490 --> 13:19.970
Okay.

13:20.530 --> 13:24.690
Even right now, we already have a successfully.

13:25.210 --> 13:25.770
Right.

13:28.570 --> 13:31.250
So I think that's it.

13:31.930 --> 13:36.650
Thus will be enough for the video and I will see you in the next one.
