flexbiz-server
Version:
Flexible Server
3 lines (2 loc) • 843 B
JavaScript
;const shortcutSchema=new Schema({id_app:{type:String,required:!0,maxlength:1024},title:{type:String,required:!0},link:{type:String,required:!0,maxlength:2048},stt:Number,exfields:Schema.Types.Mixed,visible_to:{type:Number,default:0},visible_to_users:[String],status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});
(global.configs||{}).createIndexes&&(shortcutSchema.index({id_app:1}),shortcutSchema.index({title:"text"},{name:"shortcut_index_text"}),shortcutSchema.index({title:1}),shortcutSchema.index({status:1}),shortcutSchema.index({user_created:1,visible_to:1,visible_to_users:1}));const model=mongoose.models.shortcut||mongoose.model("shortcut",shortcutSchema);module.exports=model;