Sorry everyone in this video.
Let's continue with conversation feature.
Okay.
In this video we will use the Create Private group.
Okay.
Actually create private conversation.
Let me show you how it works.
Firstly we need to create a participant and easy group right here will be false because this group will
be formed.
We don't list anything right here.
Okay.
Actually, we need the last message.
Right?
But I will show you how we can do that later.
Right now.
Don't care about last message.
Okay.
Practice one and is work well.
Let me show you the flow.
If you take a look at the message.
When I click into No conversation or glued inside a frame or something like that.
Okay, I want it will create for me the conversation right when I click into the frame, it will create
the conversation.
And here I will create the conversation also, but it not create the conversation immediately is that
we will write a little bit of checking over here.
We will check.
Me and my friend had a conversation or not.
If we already have a conversation before we will return directly to us and if not, we need to create
a new conversation.
Okay, start the flow.
So let create us.
In here.
This reality of I will duplicate.
And I will create a.
Create private conversation.
With you to be here.
And create private conversation.
Digital right here.
What we need.
We need a participant.
Right.
We need what?
Are we missing?
Okay.
We only need one participant.
Okay.
We will need a my friend ID right.
Will be my friend.
For example, right here.
The ID of this.
Uh.
Okay.
We need to do and we need is group will be fun.
Okay.
So for that reason, I think we we just need here and we need to add a little bit objective is not empty.
And this will add a.
Class and go here and I will copy and paste over here.
Create private.
So here we will in order to create private we will need a little.
And we need a current user okay.
Because we need a me and my friend right.
Although we need to find exited.
The conversation right.
We do away.
We need to inject that.
Let me be a little bit.
Okay.
Let me copy the constructor over here.
Headers here.
Inject model session.
Over here.
Okay.
Let me show you how it can be fine.
We need to await this dot position model Photo Profile one.
Okay.
And we need to add a little bit over here.
Firstly we need to boost the is work with before right.
Because this is the private.
So for the Is group but based phone.
And we need to try the one.
Okay.
So here we will use the own method.
Uh right now.
With the current user dot add.
And.
Put an arrow.
Over here.
Okay.
We need to Information, right?
Because when I look right here, I want to know A and B has a conversation or not.
So for a reason we need to check.
All right.
We need to check all the brass.
So for a reason we will check a little bit.
And if it already exists conversation I will return directly last.
And if not we need to create and return a new.
Okay.
If not, we will return.
Or we can call the conversation.
Piece we wafer and proxy statement will be current user ID and participant added over here.
Okay.
And we will return conversation dot save methods like that.
Okay.
Now let's make this go to the conversation controller and create a method conversation slot private
okay.
And create private over here and create private method and put the current users.
Over here And create private.
Maxwell.
Uh.
Maxwell will use the authentication.
Now, let's open the postman and test it.
Here, I will duplicate the command.
And change the follow into conversion.
And right here let me rename it to create conversion for a private conversation.
Okay.
Let me change into conversations.
Okay.
And inside the bodies we need to do the JSON with.
Okay.
So.
I okay with the ID of the user.
We want to create the private group.
We want to send a message okay.
For example right here I will log in.
With the account I Zandra here.
Uh, we need to start the server.
And, uh, in that time, I will go to the goodie bag.
Now, let me, uh, say.
Um.
I'm gonna send a request.
Oh.
Okay.
We have an error from the last message.
Uh, let me double check.
These are conversion.
Schema.
Or make sure we vote.
Over here.
Very good.
All right.
Message.
Okay.
Now let me say.
I will side with the account.
And boost authorization type over here.
Okay.
This is my account.
And I will create a conversation between the Android users.
With this account.
Okay.
Zone one, let me copy and click on authorization.
Oh, sorry.
Let's click on the vulnerable area over here.
Okay.
And let me say.
Um, let us Absolutely not.
We already have a bit of roll over here.
Korea.
Private.
Oh, sorry.
We should put the private over here.
Okay.
Let me say right here, you can say we already have the data between me and my friend over here, right?
Me and my friend.
And, uh, of course, right now, we need the one information in here.
Let me open the schema.
We need to know what is the owner of the conversation.
Okay.
For example, inside a group chat, we want to know what is the owner and only the owner can, delete
entire conversation, right?
So for that reason, in this case, I will provide one more view.
On on Ruby user document also and make sure we will does.
Okay.
And when I am a current user I'm a when I create a row I want the current user will be the owner okay
the the here it means who code.
Is creates this row okay.
So this will mean.
I will go up And click on Create Private.
Okay.
Actually, private don't need to know what is the owner.
Okay.
So for that reason right here we can boost this.
It will be optional.
And we need to change it to Google Group owner.
Okay.
Only later.
Only the group with a zero here will be true.
We will boost the group owner.
Okay.
That is not about the group owner.
That's me.
So what?
Right now we already have a successfully owner participant.
And we already got the me and my friend, right?
And each group here will be for so very very good.
And that's for a video.
So I will see you in the next one.