const mongoose = require('mongoose')

function image(img) {
   return '/uploads/images/slider/' + img
}

const SliderSchema = mongoose.Schema({
   image: {type: String, get: image},
   slider_details: {
      fa: {
         title: String,
         caption: String
      },
      en: {
         title: String,
         caption: String
      }
   },
   created_at: String,
   updated_at: String
}, {
   toObject: {getters: true},
   toJSON: {getters: true}
})

module.exports = mongoose.model('Slider', SliderSchema)
