From the course: Firebase Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

The Submit Review function

The Submit Review function

- [Instructor] Okay, the next cloud function that we're going to write is a cloud function for submitting reviews. Now, if we were really releasing this application, we'd only want users to be able to submit reviews for restaurants that they've already been to. We don't want some user to just be able to write a bunch of reviews willy-nilly for any restaurant. However, for simplicity's sake, we're going to skip that logic for now. It's fairly easy to implement, and I'm sure that you'll have the skills after this course to do so if you really want to. One thing that we will be implementing, however, is that we want our submit review cloud function to recalculate the average rating for a restaurant every time a user submits a new review. I'll talk a little bit more about why we want to do this in a few minutes. First, let's get started by creating our new function. We'll call it SubmitReview.JS, and we're going to create it…

Contents