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)