Hi everyone.
In this video, let's go to the notification service and create a method for creating notifications.
Okay.
And right now we don't need any resolver query notification.
Why?
Because right now we need to route directly.
Data over here.
Okay.
Why?
The reason is very simple.
Because we don't have any controller for creating the notification service okay.
Instead what we do we will use the method right here in our sys module okay.
For example line Reaction module.
Okay.
When we click into the reaction, we need to call the notification service dot create notification and
it will create a notification okay.
For that reason we don't have any controller and we don't need this also for the reason.
In this case let me say what we need.
Firstly we need the sender ID and we need to send the ID over here receiver array.
And.
The type.
Of the I.
Notification type.
And content.
Without this is read with this link to edit.
Link to edit right here can be undefined.
Okay, we can put that or not.
It totally depends on the tie over here.
I will call string.
Okay.
And we need to inject the notification module.
Model over here.
Now that we are over the pass in service we moved over here.
Remove.
Import notification.
Okay.
After us inside the create method and we will call notification equal equal new list dot notification
model.
And we need to put everything.
Over here.
Okay.
After us it looks like.
And of course we need to send.
We need to send this thing in real time.
Right.
I will show you how to do that.
Like that.
Right now let's use the create method.
Right here inside on controller.
We don't have any controller for create.
We only have the controller for Mark three.
Okay.
We will use it.
We will go right.
We need to update.
We will have a controller for update okay.
All we need to do that.
And maybe we will have Mark on notification.
Right.
Press will be show okay.
So we only have two controller okay.
So for result in this guy we only need to Use the batch.
And actually we have a one more thing we will get.
Oh sorry read user notification.
Also okay so right here let me say we need to.
Here here here and remove here okay.
We only need three method.
Maybe we also don't need the five one.
Okay.
Let me remove the file one.
Also if we need I will go back and create.
Let remove on you in touch.
And let's say how we can create a notification.
Well in order to create a notification Finally, we need to inject that.
For example, uh, R1 send a notification when the user react.
Okay.
Um.
Let me say in here inside the box a bit, we have a method for art reaction.
Okay.
I will send the notification when the user reaction.
Right.
It means after here.
Firstly we need to inject the notification shove it and notification service or notification module
right here should be global More because I don't want people thus again and again and again.
Okay, so for that reason in here, firstly we need to extract the notification service.
And after that we need to mark this here will be global okay.
With this thing we don't need to import the notification module outside okay.
We don't need to manually invoke notification module over here.
Right here inside.
The notification service let me inject notification service.
And let me run the application to Does it have error or not?
It have error because I forgot to import the.
Schema into the module after notification.
Ah, maybe I will copy from ah.
Boss module over here.
I will go.
Moreover.
Let us.
Forget the obligation of work.
Let's go and go to the bus service.
Right here.
Let's see how we can improve.
How we can use that.
For life.
Right here.
What is the sender?
And the sender idea will come from the current user over here.
Right.
And.
What is the receiver.
End result.
received a call from the whole creator box right here.
Right.
Let me show you.
What do you mean?
I will send a notification.
This notification.
Sorry.
Don't.
Cry.
Okay.
What will be the sender address?
Okay.
And what is the receiver ID?
Let me see.
Right here we have a boss.
Bot over here.
Okay.
If you remember, these are the boss schema.
Let me open it.
We have the author.
Okay.
So for this guy, we can work both on.
And off screen.
All right.
And with the tile, the tile here would be for sure.
Would be.
Like, actually we should use the reaction.
Mm.
Sorry for that.
Let me change the reaction and change this here into reaction.
Okay.
Let us mode reaction and the content.
What's the content where the content will be.
Uh let me boost let me create content.
How will you demonstrate whoever is a.
Current user dot name.
Plus react.
Maybe.
This is a type I reaction time.
Okay we have this here.
So first I will copy the type here class react.
So the vast.
And come over here.
Buddha's rock.
And one more base remains.
The link to ID, right?
What's the link to it?
For sure will be the boss, underscore and Turtle Street.
Okay.
And make sure we await us, because this is a synchronous operation.
With this here, we already have.
Right.
So let's.
That is.
Let me check that by.
Click on boss.
And.
I will copy this idea of the boss over here.
And go to.
The.
Aria, sir.
In here.
Let's replace the boss.
Okay.
And I will be happy.
Okay.
And, uh, one more thing.
One more thing.
Which is, uh.
The authentication with authentication with the Thomas account.
Because this is the post of the zone.
Right?
Now, let me say we already got the success.
And let me check the value of the notifications.
Now you can say, uh, right here, but we don't have any.
Reaction.
Well, we have a little bit of a roll over here.
We don't have any.
Standard ID or auto ID, right?
Why not?
Uh, let me try that.
Ah.
The reason, because this is should be the center.
Okay.
And so this will be receiver.
My bad.
Let me.
Remove.
The notifications.
And let me click again.
Right here.
You can say if I use exactly the same time, it will prevent.
It will also prevent over here.
It will auto play right over here.
So for this guy I will change to uh, like say.
After that let's check.
Okay.
We already got the sender ID and receiver IDs.
Right?
Receiver.
They should be the Thomas.
Let me click inside the users.
Oh, sorry.
I should be the account.
Okay.
Over here.
Okay.
And the sender address should be the Thomas for sure.
Okay.
That is.
And this is our boss.
And we can base all the information to, uh, redirect it into the ID, into the post with this ID on
the front end.
Right in the front end.
You just need to use some routers.
Okay.
To link with this URL.
And I hope you understand this video.
So I will see you in the next.