-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathModerationItem.js
More file actions
44 lines (42 loc) · 1.01 KB
/
ModerationItem.js
File metadata and controls
44 lines (42 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const mongoose = require('mongoose');
const ModerationItemSchema = new mongoose.Schema(
{
contentId: {
type: mongoose.Schema.Types.ObjectId,
required: true,
// Dynamic ref based on contentType if needed for populations
refPath: 'contentType',
},
contentType: {
type: String,
required: true,
enum: ['Post', 'Comment', 'Profile'],
},
contentSnapshot: {
type: mongoose.Schema.Types.Mixed,
required: true,
comment: 'Copy of the flagged text or data at the time of flagging',
},
status: {
type: String,
enum: ['pending', 'approved', 'rejected'],
default: 'pending',
},
flaggedBy: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true,
},
reviewedBy: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
},
reasons: [
{
type: String,
},
],
},
{ timestamps: true }
);
module.exports = mongoose.model('ModerationItem', ModerationItemSchema);