So let's create the schema for conversation and message.
So let's do that.
Open the project and create the new resource.
The first one we will convert session.
We need to create two class at the same time.
Create a message.
Okay.
Let one one by one.
And I completely forgot to remove the file.
Let's remove.
Okay, now let's go to the conversation and change the name.
Okay.
The first one I will prepare the structures for conversation schema.
Let me copy one of those.
I write a command.
I will copy everything from the command.
And let's start over here and change a little conversation.
Here and here.
And generate conversation schema and conversation document.
And let me remove.
Well, what we need is a conversation.
We need the participant.
Let me show you what exactly does not worry.
Participant can be the user.
All right.
And make sure we grab this type right here inside.
Right.
And we will run it to the user okay.
What exactly about the participant field.
Now let me show you what exactly does.
If you remember in here this is the conversation right.
And inside the conversation we have a multiple users.
Maybe I am logged in with account I.
I want to The conversation with the baby.
Okay.
It means right now the participant array will contain the I and B.
Okay.
Me and my friend.
Okay.
And if we only have two user, we can call this in the private chat.
Okay.
And in order to mark it with group chat we can add mutable U user over here.
Okay.
So that's about participant.
I hope you very clear.
And right here we have one more feature which is group with boolean okay.
And.
With this file okay.
This file will be formed by default.
This is the private chat.
And.
Now let's say we have a avatar, right?
The avatar group name and the message right here.
Okay.
We need that information for library group avatar media file.
I know media.
File media type over here from the global.
Okay.
We need avatar.
And we need the group name screen.
And we need the message right here.
Okay.
This we will call the last message.
Okay.
The last message right here will be somehow Show, right?
The last message will be somehow show over here.
But I don't know why this guy is not show in last image.
But don't worry about us, okay?
So in a real messenger application, the last message over here, we may somehow show over here.
Okay, that's what I want to build right here.
Uh, we need to load the last message.
We need to build a message.
Uh, number one.
Right.
We will import that over right here.
Let's go to the prop.
And own up.
That's right.
Here can be.
Undefined because we only have a group avatar and group name if the age group will be true.
Okay, so for that reason, now optional.
Over here.
So let's create the.
Message schema.
Okay.
Now let's copy entire conversation.
Paste that over here and change the name to message.
Here.
And message document and write here message schema.
Okay.
Let me remove follow Inside message.
We want to know the message.
Belong to the conversation.
Write the message here.
Belong to one conversation.
Okay, so for that reason in this guy we need to convert session.
We will convert session.
And remove the array over here.
Now with the conversation document for better.
And right here make sure you change return into the conversation.
Let me remove some unused import.
Okay.
Right here we already have a conversation.
And right here we have a sender okay.
We need the sender.
It will send this message.
Me or my friend.
Okay.
We want to know that, right?
So for that reason, we need to boot the user document over here.
And we need a proper makeup by.
Users.
Okay.
After that we need the prop for test okay.
The test right here.
And we also need the media file.
Right.
We will I sorry.
Media files from the global.
All right.
And boot from over here.
Verify can be optional.
Right.
Okay.
And now this media file.
Let me see.
Uh, we have a is the least messy option over here.
Okay, we will have a message.
The the option for the list, a message.
So for this guy we removed is delete because the message cannot be deleted entirely from database.
Okay.
We only want to delete.
So the list.
Okay.
So here we need to put the property file with the phone.
Okay.
We need to change it but to draw in later.
Okay.
We already have.
And we have one more thing will be a see.
Also.
Okay.
The message right here can be seen.
But I think the best way we can would've seen by right.
And right here we can put the user document because it later inside a group we can seen by another user.
Right.
So let me copy this tile over here.
The tile from user.
Put it over here and wrap it inside a right and user user document okay.
For example inside the group we have a some frame a, B, C and d okay.
With my login with my account and I send a message.
Hi there.
Okay.
But at that time only the be seen.
My message.
It means right here we will create the seen by with the weight over here.
Right.
And we can buy a dog to show it to you.
So that is the general idea about us.
Let me say we have next.
Um.
So I think, uh, that will be enough.
And go back to the conversation and put that over here.
Okay.
And let's import that into the module.
Let me close everything and let's copy.
This imports and.
Oh, sorry.
This is a conversation.
My bad.
Conversations.
Okay.
Go through the message and.
Be back here.
Yeah.
Okay.
So that will be enough.
And I hope you understand why I need to build that.
Okay, so I will see you in the next.