Files
orisoxin/server/models/Gallery.js
T
2024-10-10 21:57:37 +03:30

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)