Add user movie ratings and refresh movie cards
Store per-user 5-star ratings with averages and surface them in the player. Refresh movie list layout to show ratings and details in a cleaner card layout.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const movieRatingSchema = new mongoose.Schema({
|
||||
movieId: { type: mongoose.Schema.Types.ObjectId, ref: "Movie", required: true, index: true },
|
||||
userId: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true, index: true },
|
||||
rating: { type: Number, required: true, min: 1, max: 5 },
|
||||
}, { timestamps: true });
|
||||
|
||||
movieRatingSchema.index({ movieId: 1, userId: 1 }, { unique: true });
|
||||
|
||||
module.exports = mongoose.model("MovieRating", movieRatingSchema);
|
||||
Reference in New Issue
Block a user