In the last lecture, we created an inventory using create endpoint we ran into issues and we fixed it. And what we are going to do is we are going to use a request body in all other lambda functions. So let's copy request body from add inventory function. And let's replace this with all the events defined. In all the lambda functions let's go to delete inventor first. And let's replace event with request body what we are getting as a request body so request body just replace request body here, and we should be alright let's copy it here and let's replace this In update inventory function we are here just replace this event with request and body and also all the other parameters and attributes what we want to update wait.
And we are now all set we have made all the changes, get inventory doesn't require any changes because we are not accepting any request in body. So that is absolutely right now, what we are going to do is we are going to update an inventory in the database. So let's replace API endpoint is going to be same but we are going to replace it with update let's update with a name so we can be sure to work we are going to change with USB mouse one year ID three. Let's listen That I have updated an update. And obviously the request is now successful. And once we refresh dynamodb we now see that Id three roll.
It has been successfully updated. Now, let's let's try to delete an inventory and see if we are able to do that delete and we don't get all of the details, we just need the ID to delete an inventory. And we have all the inventories here. Now, let's test this functionality. The request is successful and when we press here, it's gone. So I believe and found is autos working successfully and we have tested it.
Believe this fine. Let's create another inventory. And also let's try to get all the inventories and then we can wrap up this lecture. So now let's create that inventory in the database. And we are able to create it successfully once we refresh dynamodb. We see this in Dynamo dB.
Now let's go to let's update is in stock flag with false from true. We think that is not in stock at this moment and what we are going to do is we are going to update with rock solid USB mouse. And let's send this request. Once we go into dynamodb, we'll see is in stock should be false. And here Indeed, we see In the stock flag is false and that inventory is currently out of stock. Again, what we want to do is to so that inventories in the stock.
Now what we are going to do, we are going to get all the inventory. So we are sure that what other inventories are in the database. And whatever we see in the database, we should be able to see everything here. So, in this lecture what we did, we tested all the endpoints successfully, we were able to create an inventory, update an inventory, delete an inventory and get all the inventories from the Dynamo TV. We have come so far, very great job. And this is all about all this course.
But as a bonus lecture we are going to consume all these endpoints in an Angular seven app in the next lecture.