Hi everyone.
Right now we already completed the conversation.
In this video, let's go to the message and write the survey.
Okay.
The first survey we will send a message.
Now you can say right here okay.
Firstly we will get all the message in conversation.
I will do that in later okay.
Right now let's focus into the send a message to conversation okay.
With the conversation okay.
We need the conversation.
I need to know the conversation.
We want to send a message.
Right.
So let's focus on that.
Below I will create a little I will rename it a little bit will be send message.
Okay.
And right here inside the create a message little I will rename send message over here.
And send message with your.
Now let's see what we need to, uh, to to property inside the send message a little bit about the schema.
Firstly we need the conversation.
The conversation right here will be come from the ID right from the ID.
So we don't need to, uh, create a detail for that.
And the sender right here.
The sender right here is the current user already logged in.
We don't need that.
Also, we need a test for sure.
We need a media file.
Okay.
We will.
Um.
All right.
Uh, media type over here, right?
Uh, let's see what we did.
Uh.
We, uh, don't need to sit by right now, okay?
We already test and media files.
Let me show you right here.
We will.
Is not empty.
And right here we basically optional and paste.
All right?
Okay.
We don't need to.
We just need to check box paste the message service.
Let me rename.
Removes the query a message little.
Okay.
Let me destruct.
Turin does.
Okay.
Now let's say firstly we need to inject the message model inside the service.
Let me try to open the conversation and copy that.
Would over here.
Sorry.
Message.
Versus model.
Let me remove the user.
So maybe we will need that later.
Okay.
We already inject the message model.
And right now let's see how we can create the same message.
Okay.
Right now which are the two creators.
As usual this dot message model we will use the new operator and boost the model over here.
Now you can say right here we have a bit up for you.
If you say right here we need the convert session.
Okay.
So for the reason in here we need to put one more session ID Street rough.
So for this conversation, I'm over here.
Not the first one.
And we need a center.
What is the center?
The center will be called from the current user.
Right?
And center will be called user ID.
We need a test.
Okay, let's move the test over here and verify over here.
And.
We don't need to see the list because by default it will be false and seen by.
Let me show you when we create a new message.
The symbol will be.
uh, current user also.
Right.
When we send a message, it means we send the message.
Right?
So that's about the message over here.
And we will save that.
And if you remember us.
Inside conversation we have something called last message.
So how we can manipulate us.
Well it's very simple.
When we send a new message, it means the new message over here is a last message.
Right?
So right here we need to update last message in conversation okay.
How we can do that.
Firstly we need to inject the conversation over here Roy.
Robert.
Survey with a survey and make sure we spot that.
Go to the conversation module.
Spark conversation survey.
Okay.
And inside the message module.
Let's import the conversation.
Module.
Okay.
And I run right here.
Come from the controller.
Don't worry about us.
We already got the conversation service and update us in order to update us.
We should write the logic inside the.
No.
Conversation of it will light.
Up that last message.
Okay.
Right here.
We only need a conversation ID right string.
And we need to update that.
I will I will call this not.
Conversation model dot find by id and that.
Would add it over here and last verses where is um.
Last message over here.
Okay.
In here we will improve the last message.
Oh, actually, we can need to view the ID.
This should work.
Let me call the message ID.
Okay.
What message are they over here?
And new job.
And I see.
Here we need to write a chat with no conversation.
Throw new error.
Sorry.
Not found error.
Etc..
Sorry.
Uh, conversation.
Not far.
Okay.
We don't need to return anything Services with.
We need to provide this dot conversation dot that last message.
We will converge session ID right here and message ID come from here.
I will call the save message right say message not underscore.
And right here you can convert it to script okay.
So not about the same message.
And in later for sure we need to do the real time over here.
Don't worry about that.
So let me go to the message controllers.
And finally let me remove the create message video.
And ten.
Message.
Send message right here.
Conversation.
And we need to change a little bit.
So let's change the controller into the message.
Okay.
And boss, last conversation.
The last conversation.
Let's say conversation.
Conversation okay.
And finally we need to conversation.
And let me use the param with the conversation I.
And passed.
Away.
I.
Had a rebellious streak.
Okay.
Said Mrs. Little.
And one more thing will be the current user.
Okay.
Current user.
We should use the God.
We got the error.
Come from the update message.
Little bit will go here and remove this.
Okay, now let's open the ibai tested.
RM right here.
Let me create a new folder.
Have you got the folder?
Right.
Here is a message.
And now I will run it.
Mm.
Hit very hard to the right.
Let me.
Ah!
Did it.
And in here.
I will click new folder right here.
Message.
And outside okay.
Okay.
Maybe like that.
Uh, or, uh, ATB request.
Or we can try to.
Duplicate this here.
And inside the message and chain.
let me close everything.
Is right here.
Sorry.
My bad.
My apologies.
This is the first time I use this thing.
Okay.
No.
Maybe I will add a new request.
Or Italy hub over here.
Let me delete.
Okay.
Let me change.
Change.
There.
We do.
Send message.
And message.
Over here.
Inside the body.
We bought a little bit, but like we told the message conversation.
And I will copy the conversation and.
I.
Put that over here.
Okay.
And over here we need to mark the text will be Aria.
And we need the media file.
Let me remove the media file right now.
So right here let me say.
Um, but before that, we can sign up or sign in with this access token.
And say.
Uh, we don't have any.
Right now.
But right here, you can say it's already created with the status to award.
Let me go to the database and refresh.
Click on the message.
Okay.
Now you can see we already got the headers and media file.
Okay.
And the sender right here will be my ID.
And the symbol here will be my ID also okay is deleted will be false.
Phones.
So let me, uh, send one more time.
Uh, right now we need a media file.
Okay, let me upload something.
Or we can upload multiple into the body right here.
Let's show the file.
And I will show something.
Which you follow here.
Um.
We should not allow ways.
To show mutual fire at the same time.
Let me say.
Mm.
What about right now?
Sure.
Okay.
And my boy, let me say upload multiple files.
Huh?
That we are really here.
Delete.
And duplicate.
What the URL is their bodies.
Let me show five.
Okay.
This here.
And let me put one more file to say it.
One or not.
So far.
Here, let me say.
Okay.
Right here.
We still have let me copy this array entire array over here.
Copy that and choose the send message in here.
Let me put media files over here.
Okay.
And let me say so by the way to a one and refresh.
Right here we already got the media file okay.
This here and this here.
So this already work right.
And that's for the video.
I will see you in the next one.