const mongoose = require('mongoose'); function image(img) { if (img) return '/uploads/images/links/' + img } const LinksSchema = mongoose.Schema({ title: String, url : String, icon : {type: String, get: image , default : null}, index: {type : Number , default : null}, showInHome : {type : Boolean , default : false}, _creator: {type: mongoose.Schema.Types.ObjectId , ref: 'User'}, _updatedBy: {type: mongoose.Schema.Types.ObjectId , ref: 'User'}, siteMap : {type : Boolean , default : false}, modelType : String }); module.exports = mongoose.model('Links', LinksSchema);