transfer project in github
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
const mongoose = require('mongoose')
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(file) {
|
||||
return `/uploads/images/gallery/${file}`
|
||||
}
|
||||
|
||||
const gallerySchema = mongoose.Schema({
|
||||
image: {type: String, get: image},
|
||||
caption: String,
|
||||
shortCaption: String
|
||||
})
|
||||
|
||||
gallerySchema.virtual('thumb').get(function () {
|
||||
return '/uploads/images/gallery/thumb/thumb_' + this.image.split('gallery/')[1]
|
||||
})
|
||||
|
||||
gallerySchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Gallery', gallerySchema)
|
||||
Reference in New Issue
Block a user