27 lines
869 B
JavaScript
27 lines
869 B
JavaScript
const mongoose = require('mongoose');
|
|
|
|
function image(img) {
|
|
if (img) return '/uploads/images/content/' + img
|
|
}
|
|
|
|
|
|
const ContentSchema = mongoose.Schema({
|
|
title: String,
|
|
param: String,
|
|
email: String,
|
|
cover: {type: String, get: image, default: null},
|
|
thumb: {type: String, get: image, default: null},
|
|
showInMenu: {type: Boolean, default: false},
|
|
pageContent: String,
|
|
showInFooter: {type: Number, enum: [0, 1, 2, 3], default: 0},
|
|
showInSubFooter: {type: Boolean, default: false},
|
|
index: {type: Number, default: null},
|
|
private: {type: Boolean, default: true},
|
|
_creator: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
|
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
|
siteMap: {type: Boolean, default: true},
|
|
modelType: {type: String, default: 'ostandari'}
|
|
});
|
|
|
|
module.exports = mongoose.model('Content', ContentSchema);
|