full
This commit is contained in:
33
models/PostReportModel.js
Normal file
33
models/PostReportModel.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const mongoose = require('mongoose')
|
||||
const timestamp = require('mongoose-timestamp')
|
||||
|
||||
const postReportSchema = new mongoose.Schema({
|
||||
post_id: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'Post',
|
||||
required: true,
|
||||
index: true,
|
||||
},
|
||||
reporter_id: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User',
|
||||
required: true,
|
||||
index: true,
|
||||
},
|
||||
reason: {
|
||||
type: String,
|
||||
trim: true,
|
||||
default: '',
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
trim: true,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
postReportSchema.index({ post_id: 1, reporter_id: 1 })
|
||||
|
||||
postReportSchema.plugin(timestamp)
|
||||
|
||||
module.exports = mongoose.model('PostReport', postReportSchema)
|
||||
Reference in New Issue
Block a user