From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

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

Section intro

Section intro

Now we're going to add the rating and review functionality to the project. And this includes creating the Prisma model for the reviews, as well as the relationship between the reviews in the product and the reviews in the user. And we'll be doing this in our Prisma schema. We're also going to create some Zod schemas for validation. And we're going to have the review list component, which ultimately will show all the reviews for that product. Then we're going to have a review form component, which will open up in a dialog. We're going to have an action that will both create and update the review. So if the user already has a review for that product, then it would just update the existing review. And then we'll get all the reviews to list on the page. And then finally, we want to pre-fill the form if there's already an existing review for that user. you

Contents