20 lines
492 B
JavaScript
20 lines
492 B
JavaScript
const mongoose = require('mongoose')
|
|
const mongoosePaginate = require('mongoose-paginate-v2');
|
|
|
|
function image(img) {
|
|
if (img) return '/uploads/images/partySet/' + img
|
|
}
|
|
|
|
const PartySetSchema = mongoose.Schema({
|
|
title: String,
|
|
description: String,
|
|
index: Number,
|
|
price: {type: Number, default: 0},
|
|
active: {type: Boolean, default: true},
|
|
image: {type: String, get: image}
|
|
})
|
|
|
|
PartySetSchema.plugin(mongoosePaginate);
|
|
|
|
module.exports = mongoose.model('PartySet', PartySetSchema)
|