Okay, so after we already defined the schema, let's try to solve it.
Okay.
Right now let me rename a little bit I forgot us.
We will rename those commands schema.
Okay.
And we need to import the schema into the module.
Let me open the regression module.
I will import this thing.
Let me go back to the command module.
Pass over here.
Schema like us.
So after that select over the service.
We need to create a video.
Okay.
Let me upload it to you.
Let's say what we will put over here.
We need to know what's in the box.
Okay.
We can go.
Boss, ID or something like that.
I will call this body for, uh, better.
We need to parent the parent command right in here.
I will call the parent command.
And this can be no right.
And we need the reply to user.
ID screen or no.
And content.
To be way street.
Okay.
Right here.
The boss ID will be is not empty.
Will be required.
Okay.
And the content right here is also required.
With the pattern and reply to user ID we need to add is Google ID.
And here we will also and here will be also.
And with this thing we need to add the is optional.
Here okay.
This for the create command little.
Over the command.
Solve it.
Let's see how we can write it.
Firstly we need to find a parent command.
Okay.
Now let let me write the code for you.
From here, we need to find if the parent command exit.
We will create a command for nested.
If not, we will create with a button.
Command will be known.
Okay, for that reason, firstly we need to check.
We command on the parent or not.
Okay.
But before that make sure the words should exit first.
So for that reason, in order to make sure the bot will be exist, we need to inject the bus service.
Also in here I have A51 method over here.
Right.
And in this guy We need to remove the private because we need to use us in our size.
Okay, so open the box module and I will explore the box service.
And right here inside the command module I will import the.
Class.
Okay.
Now let me remind for you give me a start.
Let me reminder for you.
Firstly, in order to reuse the bus service in outside module we should export service.
Okay.
And from module we should import entire module.
Okay.
An entire module right here.
It will.
If you say we have a small.
So for that reason we can use most of it.
Okay.
That is I hope you right now will be very clear.
So right here we should inject current chapter I think I will copy from reaction Service.
Or most of it.
So we just insert a box of it.
Over here.
And we need to inject the command.
And about the bus service.
Okay.
Right now we want to make sure basically.
Are we?
Are we over here?
What's over the bus?
So Is this?
If not, it will throw the error directly inside here.
Okay, we don't need to check inside here.
After we already have a boss, we need to find the pattern.
Okay.
The pattern command.
Right here we wait.
Command model.
Not found.
By body.
Uh, okay.
We will move the pattern over here.
Okay.
And if.
If the pattern is this.
What we need to do.
If the pattern as it are.
I will write a code.
Line later.
But right now, what happened?
If outside the pattern command, we need to create a model, right?
We need to create this dot command model.
And we need to use some property for that we will contain.
Both a little bit with parallel.
Well what is the parallel.
We need to code a little bit over here.
And the boss okay.
We already have a post over here right.
And we will put the reply to user.
So we have a Are told him we need to fix that first.
They will be the parent and reply to user okay with a reply to the user.
We just need to boost directly over here or we can inject the user.
Okay, we can inject user and do similar with that okay.
So okay now we already have a wrapper to user also.
But the real question right now is what exactly the parent.
Well we need to check a little bit.
If right now I need to run the code over here.
If the parent command added, is it because it can be done right?
We can say this is string unknown.
So for that reason we need to check a little bit over here.
We need to find The pattern is we need to find us.
And if a pattern command not exit, okay, we will throw new exception.
Do not exist.
Okay.
Uh, after here, we need to somehow know what's the pattern, and you can say, let me, uh, write
a little bit of code for you to understand in later.
We have a command object.
First of all, let us.
We have a content box reply to user also here.
Right.
And with the parent.
With the parent we want it will Point pour back.
Into the pattern of domestic demand.
Right.
Right here we will it will pull back.
So this thing.
This thing.
And what happens if I plug into the network command right here.
So first of all it's on the menu here we have one more thing.
I want it to also point back to the pattern okay I don't want it will pull back to here okay.
That's the key one I want to build right now.
So for that reason in this case um I will create the next variable will be real power.
Okay.
All right.
Ali.
And over here I will need to write a bit of.
A pattern command.
Not.
Dot.
Underscore.
ID as it.
Okay.
Everything is it?
We will tackle right tackle.
What?
If not, we will take a look at the, uh.
Not okay with this thing.
One is here.
Firstly, we need to find the pilot.
Okay.
We need to find out if this thing have a parent.
Okay.
We will take a look at that.
And if not, we will take a look at directly the ID of the score within it on white paper to the pattern
over here.
It cannot point back into here if we are nested so many times.
Okay.
If we netted so many times it on on, why go back to the root that is.
And we do both.
So.
This is object id Hmm.
I will regret that after I die.
And.
Also.
For some reason, let me say.
Ty.
Let me put over here.
In.
What a tie.
Okay.
Let's remove the object over here.
And the reply to user.
We need to find out.
Also, let me inject the user.
Submit.
Let let me say we have a user submit or not.
Inside the user service we have a file one method okay.
In this case we need to write a code we have got.
Right here we should inject also.
And over here.
Into.
Users.
Okay.
Right now I'm sure you got that right.
Okay here, we already have A51 method and make sure we need to export and save it.
After we already established import insert command.
After that let's go here and inject the user service also.
After here, let me find out.
User replies or reply to users.
Well, we need support over here.
And let's face a little bit over here.
Screen.
Right here.
Uh, because it can be known price of a result.
You know, before that, we need to check.
A bit as it we will buy over here.
And for that reason we need to create another variable.
Output over here.
And I will create a new variable.
Real reply to user ID, some stuff like that.
And right here I need to check.
I don't need to check because I already checked over here.
Right.
We need to apply to user.id.
Okay.
Nice.
And right here we already got the reply to user ID and password.
So for that reason we moved over here.
Okay.
And we have service.
Let me click inside user controller.
Remove the casting.
Okay.
Let's say right here.
It already worked.
Let's remove some stuff.
Okay.
So this is the logic.
it and we need to test that also.
Let's open the box.
I will add a new folder.
Let me duplicate the carrier box and drag it into the command and general create command.
Commands.
And make sure we change the other commands over here.
Okay.
Right now we don't have.
A jump from the two attributes later.
Right now, let's make sure the code work.
For every box.
And.
Let me get on, boss.
I will paste the ID right here.
But the.
Next thing we will contain.
The boss.
Your price.
And pattern command.
And we can do that.
Let me know.
A reply to user.
You can go.
No.
Also okay.
Let me say um, um.
Okay.
So let let me, uh, say.
We are recreate right.
Right here will not return anything.
So for that reason it doesn't okay.
But.
Let me I want to.
Right now.
Let's look into the command.
Oh, because we forgot to save that.
Command in I will return.
Command lost.
Save.
Okay, so right here, we already returned.
And let's say.
Now, let me say right here.
We already got those.
Follow me.
We are the host.
We will return the boss.
So.
Okay, this is the boss we want to command in later.
We need to transform it first of all.
So here will be powered by the user content.
Okay.
We have content right here.
And we have an id okay ID of this content.
And what about if I.
Copy this thing and I will put that inside the parent command right here.
Okay.
And see right now we we need to reply to user okay.
For example in here Reply to user.
I will reply to myself okay to myself it mean go here.
Let me try to reply to user ID.
We just click.
Or we can go a little bit.
If the reply to user is unknown, we can pop up to the outer ID of the box.
Okay, because you can paint over here.
We want to uh, the reply to user will be the whole creator box okay.
And if we reply Realize also we will come back to here.
Okay.
You can call us also.
It doesn't hurt or whatever.
Now, I will keep it like that.
And I will say right here, we already created this here parallel content.
Okay.
And let me now let's take one more time.
What happened next step into the new ID.
Okay.
You can say right here.
So.
Okay I will test it right here and uh change it.
So.
As you said.
Now let what pattern.
Now you can see the pattern here is still point to the oh one.
It did not pop up to this parallel, right?
Did not pop up to this pattern itself.
It will use the root pattern.
Okay.
Let me check the data by.
Play.
This is the root and this is the network command with the id zero say the root command okay.
This is the root command.
And right here we are back to the root command.
Right.
We are back to root command.
And right here will be also okay with.
All right.
Back to the command over here.
So that is I hope you understand this video and I will see you in the next one.