const mongoose = require('mongoose') const timestamp = require('mongoose-timestamp') const commentLikeSchema = new mongoose.Schema({ commentId: { type: mongoose.Schema.Types.ObjectId, ref: 'Comment', required: true, index: true, }, userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true, index: true, }, }) commentLikeSchema.index({ commentId: 1, userId: 1 }, { unique: true }) commentLikeSchema.plugin(timestamp) module.exports = mongoose.model('CommentLike', commentLikeSchema)