flexbiz-server
Version:
Flexible Server
4 lines (3 loc) • 893 B
JavaScript
const model=global.getModel("deal"),controller=require("../../controllers/controller");
module.exports=function($router$$){(new controller($router$$,model,"deal",{sort:{date_created:-1},onView:async($user$$,$items$$,$callback$$)=>{await $items$$.asyncJoinModel2($user$$.current_id_app,"customer",{where:"ma_kh",fields:["ten_kh","dien_thoai"]});await $items$$.filter($item$$=>$item$$.ma_dt).asyncJoinModel2($user$$.current_id_app,"dmdt",{where:"ma_dt",fields:["ten_dt"]});await $items$$.filter($item$$=>$item$$.ma_nd_quan_tam).asyncJoinModel2($user$$.current_id_app,"nhadat",{where:{ma_nd_quan_tam:"ma_nd"},
fields:[{ten_nd_quan_tam:"ten_nd"}]});$callback$$(null,$items$$)},onFinding:($user$$,$condition$$,$next$$)=>{$next$$(null,$condition$$)},onUpdating:($user$$,$data$$,$obj$$,$next$$)=>{$next$$(null,$data$$,$obj$$)},onDeleting:($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)}})).route()};