UNPKG

flexbiz-server

Version:

Flexible Server

3 lines (2 loc) 932 B
const model=global.getModel("bds_floor"),trangthai=global.getModel("trangthai"),building=global.getModel("bds_building"),controller=require("../../controllers/controller"),async=require("async"),floor=function($router$$){(new controller($router$$,model,"floor",{sort:{stt:1,floor_name:1},unique:["floor_code"],notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,onView:($user$$,$result$$,$fn$$)=>{async.series({bd:function($callback$$){$result$$.joinModel2(null,building, {where:{id_app:"id_app",building_code:"building_code"},fields:"building_name"},function($kq$$){$callback$$(null,$kq$$)})},trangthai:$callback$$=>{$result$$.joinModel2(null,trangthai,[{where:$a$$=>({ma_ct:"FLOOR",ma_trang_thai:$a$$.trang_thai}),fields:["ten_trang_thai","color"]}],function(){$callback$$()})}},function($error$$){if($error$$)return $fn$$($error$$);$fn$$(null,$result$$)})}})).route()};module.exports=floor;