24 lines
485 B
JavaScript
24 lines
485 B
JavaScript
const mongoose = require('mongoose')
|
|
|
|
function image(img) {
|
|
return '/uploads/images/gallery/' + img
|
|
}
|
|
|
|
const GallerySchema = mongoose.Schema({
|
|
image: {type: String, get: image},
|
|
thumb: {type: String, get: image},
|
|
category: {type: mongoose.ObjectId, ref: 'GalleryCategory'},
|
|
noCategory: {type: Boolean, default: false},
|
|
locale: {
|
|
fa: {
|
|
caption: String
|
|
},
|
|
en: {
|
|
caption: String
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
module.exports = mongoose.model('Gallery', GallerySchema)
|