Hi everyone.
In this video let's do the real time for accept friend requests.
Okay, after we already handle the logic over here and boost that into the array of friends over here,
what we need to do right now.
Well, let's think about how the friend will consume this data.
Okay?
When I accept a request for the board right here, let's say in my database, or I already have a friend
request with the bending over here, right when I accept the request chain from the standard bending
Banded Forum accept what we need to happen firstly.
Now if I say it again, you will say we already have this data, right?
This is the bending request, right?
It means right now when I accept the request, I want the front end or I want from the front end perspective,
it will.
It will filter out the object over here okay.
And it will filter out the object based on the ID for that reason.
In the end we should send the ID for the front end.
Okay.
That's the first thing I want to do.
And the second thing really is when I accept the request I want insider.
Get my friend.
It will show the the data.
Okay.
It will boost the data from here.
Okay.
It will boost the data from here into the this array.
Right.
But we have an error.
All the reason because in previous video I already changed the friend DTO, right?
Hmm.
So for that reason, in the friend controller, we need two different method okay.
We need two different method to do that right here.
Let me.
Copy this thing.
Let me cut this thing.
And I will put inside the same friend request okay.
And, uh.
Get current request menu, right?
Actually send friend request and get request.
All right, let me, uh.
Change a little bit.
Respond.
Request, friend.
Okay.
Like that.
And the Visual Studio Code, it will.
Um, we need to rename this.
So this one write Request Studio.
And inside here, let me know that this one write request.
All right.
And right here let's fit this.
First of all, polite request.
Little did we fix that issue and insert the get.
Why remove does.
Also insert a get why?
Okay.
After that we need to create another little.
For respond.
Right.
Little okay.
We need to create the Respond Prime video.
Let's say what we need.
Let me say that again.
Please tell the controller we are.
We don't use any fertilizer over here.
So that reason we will get entire document.
Okay.
What we need to do, we, uh, need the ID and the name.
Right?
And, uh, I think we only need the ID and the name and the avatar.
Maybe we will have avatar.
Okay, so let's go here.
Follow will be the ID and the name.
Right here will be object.
Right here we we done this and it transform over here.
And one more thing will be avatar.
Let me just copy the avatar Earl.
Over here.
And in this case, we only need to object.
Dot.
Amplify.
Okay.
And insert a foreign controller.
Let me view that chart from digital.
And we need to put this one right.
Sorry.
This one.
Right over here.
Let me see.
Okay.
We already got the name.
And right here we will advertise.
Earl.
Okay.
What we need to do, we need to boost the frame into that array right now.
Let's go back to the service and I will show you.
Firstly.
When we accept the friend request, the first one we need to filter out from the friend bindings.
Or in the in the front end we will have a step for frame bindings okay.
And the second one we need to boost the object with the same structure over here.
So the my friend right.
Okay.
So for example we need to emit an media event which now met with a friend request, and they will be
here.
And we need to create exactly the same structure for that, right?
But what is this thing?
Now, you can say when we accept the friend request.
It means we need to look at.
Uh.
The sender.
The sender ID, right.
Now, even with my eyes, it's still confusing.
Let me write a little bit.
But first of all.
Right, now the sender will.
Result.
Result will send a friend Write requests to the receiver.
Ray Thomas.
Okay.
What about right now?
I will log into the account to accept.
The same request.
One same request.
And this is.
Will they accept?
We need to accept Amazon.
Okay.
So it means the zone is a foreign apple Thomas.
Okay.
For that reason, we need to send the sender information.
Right.
So for that reason in this case I will call this dot.
Z y.
Now handle.
Handle.
Accept.
request.
Alright ladies, and firstly we need to send a friend request to filter out.
Right?
Friend request over here.
Let's see what this come from.
This come from here.
Okay.
And the second one we will use the object contain this information.
Okay.
Since this is the object I prefer wrap entirely into the object following with request for sure.
And this object over here.
Right.
So we need to use for label below it.
Okay.
It will come from the senders, from friend, request sender, and a little string over here.
Right.
And the name will be friend request dot sender, dot name.
Right.
And the avatar you.
Would avatar you rl.
We should.
We should create a respondto for us.
You will say right here we have a friend request.
Let me convert this.
Uh, actually, this is should be the first one.
Rank request video.
Podcast.
We need to change the avatar.
Okay.
Over here.
We will respond.
Dot, send the avatar URL.
Okay.
We need to send this thing for the here.
Let's create us.
Here.
We change to handle some room.
And one more thing will be added to.
Okay.
We will need the receiver ID also.
Right.
We need to send receiver ID.
So once the receiver ID.
We still need receiver ID from Tomas.
Now it is scanning it a little bit Different story because right now we already logged in with the Thomas.
It means we need to send back to the sender ID, right for that reason.
In this case it is the first parameter.
I will say the sender id right.
Send id over here.
We will use for right.
Are we already got the underscore ID right here.
Right.
So for that reason in this case we can use data dot to dot underscore ID okay.
And right here we will emit the event.
We will send accept right.
Let us put the data.
Let me check.
Let us say is work or not.
Right now.
Let me test that.
Right here.
I have some bending requests over here.
Right.
We have a bending request.
We need to accept that.
Right.
Let me copy the idea over here and insert a.
Right request and put the ID over here.
And we need to login with Thomas.
Sick.
Now let me say.
We got the So.
Okay.
And let's chat over here.
Now we got this thing, but.
We have a little bit over over here.
Here.
And.
We don't get any name.
Run!
Request over here.
Let me say this is a friend request.
All.
Right.
Here we should popularize the name.
Sorry.
The sender's.
Let's do that again.
Right here.
You can put one more name.
Okay.
Let's turn that again.
Right now.
I will sign in.
Maybe I will clear.
I will clear this one.
And let me send a request again.
Right now I will log in with the zone account.
Okay.
So we zone account.
From zone account, I will send a friend request.
Send friend request.
Okay, after we already send friend requests successfully, we need to sign in with that account.
Okay, this is the entire flows.
I hope you clear.
And go to accept friend request.
Make sure you login with built here and copy the id.
Let me refresh.
I will copy the ID binding over here.
And let me before I send us.
Let me send.
We already got the status because we already removed the details for reasons we don't see the body over
here, but this don't really matter.
And right here, you can see we already got this thing right.
This thing will be the frame of the Thomas and it later.
We need to use this information to put that back to the gate.
My friend over here.
And you will achieve the.
We will achieve the.
Time.
Right.
We are saying with Thomas again.
Right here.
You.
We already got the zone account.
Okay.
With the zone account over here.
So it means we already successfully.
So I will see you in the next one.
Make sure we clean up all the way over here.
Okay, I know it's a little bit, uh, misunderstanding.
And it's very hard at the beginning, but the important, the important part right here is you should
understand what is the sender and what is the receiver.
And maybe in the front end, uh, you can create some documentation for the front end to have the front
end developer can understand what exactly about the sender and what exactly about the receivers.
Okay.
Even with my if I leave this project maybe one week and I will go again, I will not understand.
Okay.
For sure.
So please don't stress.
But let's talk a little bit of time to understand so I will see you in.