38 lines
885 B
JavaScript
38 lines
885 B
JavaScript
const mongoose = require('mongoose')
|
|
const timestamp = require('mongoose-timestamp')
|
|
const mongoosePaginate = require('mongoose-paginate-v2')
|
|
|
|
const advertisingCommentSchema = new mongoose.Schema({
|
|
advertisingId: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'Advertising',
|
|
required: true
|
|
},
|
|
userId: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'User',
|
|
required: true
|
|
},
|
|
text: {
|
|
type: String,
|
|
required: true,
|
|
trim: true
|
|
},
|
|
rate: {
|
|
type: Number,
|
|
required: false,
|
|
default: null
|
|
},
|
|
status: {
|
|
type: String,
|
|
enum: ['pending', 'temp_accept', 'accepted', 'rejected'],
|
|
default: 'pending'
|
|
}
|
|
})
|
|
|
|
advertisingCommentSchema.plugin(timestamp)
|
|
advertisingCommentSchema.plugin(mongoosePaginate)
|
|
const AdvertisingComment = mongoose.model('AdvertisingComment', advertisingCommentSchema)
|
|
|
|
module.exports = AdvertisingComment
|