Let's explain what just happened:
- We've made a listener over one of our diverse links: /purchases/{pushId}/item. The pushId function represents the automatically generated ID that Firebase gives to any new field that was introduced using the push() method. Also, we're listening to the item element that can be anything you have in your database, but, in the case of my store, any newly purchased item will be over the item object.
- We're retrieving that new field from the event object we've got from Cloud Functions using the onWrite() event.
- We're formalizing the status we want our status object to having.
- We're using the event object again to navigate within the structure of our database and setting the new status within the ...