flexbiz-server
Version:
Flexible Server
6 lines (5 loc) • 1.88 kB
JavaScript
;const dmphatdichvuSchema=new Schema({id_app:{type:String,required:!0},service_code:{type:String,uppercase:!0,default:"",maxlength:32},service_name:String,ap_dung_cho:{type:Number,default:0},ma_kh:{type:String,default:"",maxlength:32},nh_kh:{type:String,default:"",maxlength:1024},trang_thai:{type:String,maxlength:32},thoi_gian_tu:{type:Number,default:0},thoi_gian_den:{type:Number,default:0},tien_phat:{type:Number,default:0},ty_le_phat:{type:Number,default:0},ty_le_tra_cho_nguoi_lien_quan:{type:Number,
default:0},tien_tra_cho_nguoi_lien_quan:{type:Number,default:0},hieu_luc_tu:{type:Date,required:!0},hieu_luc_den:{type:Date,required:!0},ap_dung_lan_thu:{type:Number},picture:{type:String,maxlength:1024},exfields:Schema.Types.Mixed,newsfeed:{type:Boolean,default:!0},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:""},service_code_id:{type:Schema.Types.ObjectId,
ref:"service",localField:["service_code"],foreignField:["service_code"]},ma_kh_id:{type:Schema.Types.ObjectId,ref:"customer",localField:["ma_kh"],foreignField:["ma_kh"]}});
(global.configs||{}).createIndexes&&(dmphatdichvuSchema.index({id_app:1,service_code:1,hieu_luc_tu:-1,hieu_luc_den:-1}),dmphatdichvuSchema.index({ap_dung_cho:1}),dmphatdichvuSchema.index({nh_kh:1}),dmphatdichvuSchema.index({date_updated:-1}),dmphatdichvuSchema.index({date_created:-1}),dmphatdichvuSchema.index({user_created:1}),dmphatdichvuSchema.index({service_code:"text",service_name:"text"}),dmphatdichvuSchema.set("toObject",{virtuals:!0}),dmphatdichvuSchema.set("toJSON",{virtuals:!0}),dmphatdichvuSchema.index({trang_thai:1}),
dmphatdichvuSchema.index({status:1}));const model=mongoose.models.dmphatdichvu||mongoose.model("dmphatdichvu",dmphatdichvuSchema);module.exports=model;