UNPKG

kpiplus

Version:

KPI+

1 lines 544 B
var model=require("../../models/parameter"),rpt=require("../../models/rpt"),controller=require("../../controllers/controller"),underscore=require("underscore");module.exports=function(r){this.contr=new controller(r,model,"parameter",{sort:{name:1},onFinding:function(r,e,n){e.id_rpt?rpt.findById(e.id_rpt,function(r,t){if(r)return n(r);t?rpt.find({id_app:t.id_app,ma_cn:t.ma_cn}).lean().exec(function(r,t){if(r)return n(r);e.id_rpt={$in:underscore.pluck(t,"_id")},n(null,e)}):n("Mẫu in không tồn tại")}):n(null,e)}}),this.contr.route()};