Hi everyone.
In this video, let's customize the wristband okay.
Right here we have so many nested object here, here and here.
And of course we don't want that right.
So in this video let's step by step and build.
Let's go to the command DTO.
Let's create a new file.
Call this one command.
And support class this one command DTO okay right here the first page will be small underscore ID.
And when we use ID marks to remove the object ID over here okay.
And let's say the next thing will be the boss ID.
Okay.
We now need to populate the boss because if not, we don't need that okay.
So for that reason, in this case, we can still use the boss with a small and object over here.
It will be enough.
The next thing will be.
We will leave that later.
Okay.
Let's focus into the user command and fix the dataset object.
The user command over here.
Instead of loop directly the object with user command.
The best way is we need to follow the object over here.
It means right here we will use user command name okay.
And one more thing.
We will use our command and.
And in later we will have a user command avatar to show the avatar.
Okay.
In order for that application.
But right now we don't have avatar.
Right click add the.
Avatar.
Okay, I will create a todo.
Let us in later when we come back and fit us.
And right here also we bought a small and giant form.
Right.
And right here let's move the object and object dot user command dot add okay.
And object user dot name.
Okay.
That is.
And right here, make sure we put some question mark right here to prevent some error.
Okay.
If for some reason this here will be undefined, it will not show its data.
It will show the error.
Okay.
We don't want it.
Show the error.
Right.
So for the last one we put some question marks over here.
After that, after we have the user we need to reply to user okay.
Let's scroll a little bit with the reply to user.
It will be very similar right.
Let me copy entirely over here and Buddhas and replace it with.
Replies to.
User ID and reply to use our left and right here.
Reply with reply to user like us and make sure you later with the avatar over here.
And now we need to contain.
With a string.
Okay, now with this information let's take that or we need to create it up.
Up right.
Okay so let's move this.
This will be right.
And now we also need a pattern.
Let me see.
Current pattern right here.
Okay.
We just need to call the pattern.
With a string.
With the object.
So this will be enough right.
Now let's say let's go back to the command controller and do that.
Let's say.
Okay.
Right now we already got the information right.
User command.
User command name.
them over.
And also and right here we need to add the replies.
Right.
The replies.
So for this guy we can explore.
No replies.
Well what is the structure of the reply?
I want it to have exactly structure of one command little right for the result.
I will put the responsibility right over here.
But you can see this work are not well.
It will not work.
Let me say.
Right here it shows the replies, but it doesn't transformation, right?
Why doesn't transformation?
Because when we use the plan tool object, if you remember in here we use the something called plan
Time to instant, right?
We will transform the data into the digital sink.
We use the blend tool is done.
It only affects in the top level data.
It not affect in the nested array or nested object.
Okay.
So for that reason, in order to tell the plan to instant look up the nested array object, also we
should view the type okay with the response magnitude over here.
And let's say let me say.
Right here you can see it already work right with have a right.
Right here we have a object with user command ID and reply Two users.
Okay, we have some stuff like that, right.
And then created an add.
So very good right.
So let me remind you for you what exactly about the type right here.
Well the title here, it will allow the plane to instant.
Understand the nested data okay.
Without the terms, Next.js cannot understand.
Okay.
That checks it.
Only understand the first level object.
In order to tell Next.js, look up the nested object or nested array, we should tell it using the decorator
types from Next.js.
So I hope you understand and very clear about the types right now.
I will see you.