Welcome back.
In this video, let's work with the transaction.
So going to be the same format so you can put this video and then give yourself a challenge.
So what we have done is about creating the risk that is fetching or getting a single transaction delete
update.
We haven't implement that.
So let's go ahead and then do the Hawaiian.
So I think for this one, we can implement them at a go because it's follow the same concept.
So for fetching or it's pretty simple as this.
So here we bring in cons and then I'll pass this one as transaction trans for pure and then I wait and
then the transaction model dot find and as that I'm done.
So lastly, I need to say status code as 200 and then adjacent data as this status to be success success
and then the data as transactions.
The next one going to be the single so I can collapse this one and for the single two I need the ID.
So here cost less the structure, the id.
So read the params and here we have the ID.
So next step is that we are going to find the transaction by ID is equal to weight and then the transaction
model dot by ID and I'll pass in the ID.
So lastly, I need to send the response.
So I forgot to turn some error here.
So let's do it quickly here as next.
So let's pass it next to this one.
And down here we call next and then we call the instance of our up error.
And then they start as cold as 500 minute internal server error.
And I can copy this one.
And for fetch single to I can throw the same error.
So let's collapse this one and collapse this one.
And now let's work with the first single, which is this one.
Sorry.
Right.
So here, let's go ahead and then send the response.
So here we go, start us as always, success
and then the actual data as the transaction rate.
So the next one going to be the deleting.
So I may need the ID also here inside the delete root.
So here we are going to find the transaction dot find by ID and then delete.
So here we pass in the ID and here we send a status as success and then the actual data as now.
And lastly, let's return the error here and for the update the same process we need ID.
So here the ID comes here.
And next step is that you are going to find the transaction by ID and then update.
So it's equal to our which transaction dot find by ID and add date they pass in the ID.
Second element is the entire object and then the optional configuration new to true and then run validators
also to true.
And let me bring in the error here down here meaning that I need to pass in the next and the same thing
to this one also as next.
So we are done with the entire operation for transaction in one video.
So let's class all of them and now let's test the end point.
So back here, let's open the transaction.
So here, let's fetch all transactions and let's remove this one and let's see and this added transaction
we have grade sorry, this one supposed to be single.
So let's try again.
Let's provide the ID here and let's send and indeed the single also is working.
We go back on objects.
That is a single record.
The next step is about the updating so we can copy this one and which is what, buying moving sheets.
So inside the update, which is this one, let's provide the ID and now and the body here.
Let me explain it like this one and enter buddy.
Let's change the name to let's say and let's send the request where I got some error.
Meaning that on expired JSON format, meaning this one where I need to provide double code around it.
Sorry guys, let's save it.
And now let's get sent.
And this is a response, meaning that we are not returning the response from the request.
So here, here indeed we are returning this one status is equal to success and then the data can be
found on the transaction and that is it.
So let's go ahead and then update and you can see that the name has been changed to transportation.