Built motion from commit 362b9399b4d0ed5560fbb795af995925d345fc38. Version 3.0.0...
[motion-next.git] / server / api / voiceDialReport / voiceDialReport.controller.js
1 const a866_0x2ed9=['status','keys','attributes','VIRTUAL','filter','catch','api','intersection','params','pick','filters','fields','set','query','include','map','name','create','describe','nolimit','merge','sendStatus','stack','error','show','like','limit','findOne','count','destroy','index','sort','includeAll','Content-Range','where','findAll','lodash','../../config/logger','rawAttributes','update','body','send','options','json','offset','VoiceDialReport','../../mysqldb','end','then','model','fieldName','length'];(function(_0x2ef35a,_0x1254f7){const _0x2ed981=function(_0x18f9cf){while(--_0x18f9cf){_0x2ef35a['push'](_0x2ef35a['shift']());}};_0x2ed981(++_0x1254f7);}(a866_0x2ed9,0xe9));const a866_0x18f9=function(_0x2ef35a,_0x1254f7){_0x2ef35a=_0x2ef35a-0x1a8;let _0x2ed981=a866_0x2ed9[_0x2ef35a];return _0x2ed981;};const a866_0x4c2da1=a866_0x18f9;'use strict';const _=require(a866_0x4c2da1(0x1b3)),qs=require('../../components/parsers/qs'),logger=require(a866_0x4c2da1(0x1b4))(a866_0x4c2da1(0x1c9)),{db}=require(a866_0x4c2da1(0x1bd)),{Op}=require('sequelize');function respondWithResult(_0x30c0c6,_0x4a72b5){return _0x4a72b5=_0x4a72b5||0xc8,function(_0x46eecb){const _0x51b358=a866_0x18f9;if(_0x46eecb)return _0x30c0c6[_0x51b358(0x1c3)](_0x4a72b5)[_0x51b358(0x1ba)](_0x46eecb);};}function respondWithFilteredResult(_0x37bfae,_0x67a776){return function(_0x1abff6){const _0x4416d1=a866_0x18f9;if(_0x1abff6){const _0x1d5cdc=_0x1abff6[_0x4416d1(0x1ab)],_0x813c19=_0x67a776[_0x4416d1(0x1bb)];let _0x3d876b=_0x67a776[_0x4416d1(0x1bb)]+_0x67a776[_0x4416d1(0x1a9)],_0x3cf395;return _0x3d876b>=_0x1d5cdc?(_0x3d876b=_0x1d5cdc,_0x3cf395=0xc8):_0x3cf395=0xce,_0x37bfae[_0x4416d1(0x1c3)](_0x3cf395),_0x37bfae[_0x4416d1(0x1cf)](_0x4416d1(0x1b0),_0x813c19+'-'+_0x3d876b+'/'+_0x1d5cdc)[_0x4416d1(0x1ba)](_0x1abff6);}return null;};}function saveUpdates(_0x19db17){return function(_0xe9007a){const _0x4f5c1b=a866_0x18f9;if(_0xe9007a)return _0xe9007a[_0x4f5c1b(0x1b6)](_0x19db17)['then'](function(_0x5249ab){return _0x5249ab;});return null;};}function removeEntity(_0x3c4e9e){return function(_0x635e3e){const _0x3f73a2=a866_0x18f9;if(_0x635e3e)return _0x635e3e[_0x3f73a2(0x1ac)]()['then'](function(){const _0x256b4d=_0x3f73a2;_0x3c4e9e['status'](0xcc)[_0x256b4d(0x1be)]();});};}function handleEntityNotFound(_0x2b98be){return function(_0x4384d3){const _0x14a544=a866_0x18f9;return!_0x4384d3&&_0x2b98be[_0x14a544(0x1d8)](0x194),_0x4384d3;};}function handleError(_0x5179f2,_0x4264d6){return _0x4264d6=_0x4264d6||0x1f4,function(_0x29ab45){const _0x264cf2=a866_0x18f9;logger[_0x264cf2(0x1da)](_0x29ab45[_0x264cf2(0x1d9)]),_0x29ab45[_0x264cf2(0x1d3)]&&delete _0x29ab45[_0x264cf2(0x1d3)],_0x5179f2[_0x264cf2(0x1c3)](_0x4264d6)[_0x264cf2(0x1b8)](_0x29ab45);};}exports[a866_0x4c2da1(0x1ad)]=function(_0x2a4623,_0x5248c5){const _0x4ae9d8=a866_0x4c2da1;let _0x562575={};const _0x3a2ba4={},_0x2f5664={'count':0x0,'rows':[]},_0x27cb87=_[_0x4ae9d8(0x1d2)](db['VoiceDialReport'][_0x4ae9d8(0x1b5)],function(_0x166771){const _0x4156f2=_0x4ae9d8;return{'name':_0x166771[_0x4156f2(0x1c1)],'type':_0x166771['type']['key']};});_0x3a2ba4['model']=_[_0x4ae9d8(0x1d2)](_0x27cb87,'name'),_0x3a2ba4[_0x4ae9d8(0x1d0)]=_[_0x4ae9d8(0x1c4)](_0x2a4623['query']),_0x3a2ba4[_0x4ae9d8(0x1cd)]=_[_0x4ae9d8(0x1ca)](_0x3a2ba4[_0x4ae9d8(0x1c0)],_0x3a2ba4['query']),_0x562575[_0x4ae9d8(0x1c5)]=_['intersection'](_0x3a2ba4['model'],qs[_0x4ae9d8(0x1ce)](_0x2a4623[_0x4ae9d8(0x1d0)][_0x4ae9d8(0x1ce)])),_0x562575[_0x4ae9d8(0x1c5)]=_0x562575[_0x4ae9d8(0x1c5)]['length']?_0x562575[_0x4ae9d8(0x1c5)]:_0x3a2ba4[_0x4ae9d8(0x1c0)];typeof _0x2a4623['query'][_0x4ae9d8(0x1d6)]==='undefined'&&(_0x562575[_0x4ae9d8(0x1a9)]=qs['limit'](_0x2a4623['query']['limit']),_0x562575['offset']=qs[_0x4ae9d8(0x1bb)](_0x2a4623[_0x4ae9d8(0x1d0)][_0x4ae9d8(0x1bb)]));_0x562575['order']=qs['sort'](_0x2a4623[_0x4ae9d8(0x1d0)][_0x4ae9d8(0x1ae)]),_0x562575[_0x4ae9d8(0x1b1)]=qs[_0x4ae9d8(0x1cd)](_[_0x4ae9d8(0x1cc)](_0x2a4623[_0x4ae9d8(0x1d0)],_0x3a2ba4[_0x4ae9d8(0x1cd)]),_0x27cb87);_0x2a4623[_0x4ae9d8(0x1d0)]['filter']&&(_0x562575[_0x4ae9d8(0x1b1)]=_[_0x4ae9d8(0x1d7)](_0x562575[_0x4ae9d8(0x1b1)],{[Op['or']]:_['map'](_0x27cb87,function(_0x380a51){const _0x2fc575=_0x4ae9d8;if(_0x380a51['type']!==_0x2fc575(0x1c6)){const _0x42356d={};return _0x42356d[_0x380a51[_0x2fc575(0x1d3)]]={[Op[_0x2fc575(0x1a8)]]:'%'+_0x2a4623['query'][_0x2fc575(0x1c7)]+'%'},_0x42356d;}})}));_0x562575=_[_0x4ae9d8(0x1d7)]({},_0x562575,_0x2a4623[_0x4ae9d8(0x1b9)]);const _0x5362ea={'where':_0x562575[_0x4ae9d8(0x1b1)]};return db['VoiceDialReport'][_0x4ae9d8(0x1ab)](_0x5362ea)[_0x4ae9d8(0x1bf)](function(_0x26c0fd){const _0x57242a=_0x4ae9d8;return _0x2f5664[_0x57242a(0x1ab)]=_0x26c0fd,_0x2a4623[_0x57242a(0x1d0)][_0x57242a(0x1af)]&&(_0x562575[_0x57242a(0x1d1)]=[{'all':!![]}]),db['VoiceDialReport'][_0x57242a(0x1b2)](_0x562575);})[_0x4ae9d8(0x1bf)](function(_0x38a876){return _0x2f5664['rows']=_0x38a876,_0x2f5664;})[_0x4ae9d8(0x1bf)](respondWithFilteredResult(_0x5248c5,_0x562575))[_0x4ae9d8(0x1c8)](handleError(_0x5248c5,null));},exports[a866_0x4c2da1(0x1db)]=function(_0xf1977a,_0x2b9d4b){const _0x403e0c=a866_0x4c2da1;let _0xb1d644={'raw':!![],'where':{'id':_0xf1977a[_0x403e0c(0x1cb)]['id']}};const _0x14ee53={};return _0x14ee53[_0x403e0c(0x1c0)]=_[_0x403e0c(0x1c4)](db[_0x403e0c(0x1bc)][_0x403e0c(0x1b5)]),_0x14ee53[_0x403e0c(0x1d0)]=_[_0x403e0c(0x1c4)](_0xf1977a[_0x403e0c(0x1d0)]),_0x14ee53[_0x403e0c(0x1cd)]=_[_0x403e0c(0x1ca)](_0x14ee53['model'],_0x14ee53[_0x403e0c(0x1d0)]),_0xb1d644[_0x403e0c(0x1c5)]=_['intersection'](_0x14ee53['model'],qs['fields'](_0xf1977a[_0x403e0c(0x1d0)][_0x403e0c(0x1ce)])),_0xb1d644[_0x403e0c(0x1c5)]=_0xb1d644[_0x403e0c(0x1c5)][_0x403e0c(0x1c2)]?_0xb1d644[_0x403e0c(0x1c5)]:_0x14ee53['model'],_0xf1977a[_0x403e0c(0x1d0)][_0x403e0c(0x1af)]&&(_0xb1d644['include']=[{'all':!![]}]),_0xb1d644=_[_0x403e0c(0x1d7)]({},_0xb1d644,_0xf1977a[_0x403e0c(0x1b9)]),db[_0x403e0c(0x1bc)]['findOne'](_0xb1d644)[_0x403e0c(0x1bf)](handleEntityNotFound(_0x2b9d4b,null))[_0x403e0c(0x1bf)](respondWithResult(_0x2b9d4b,null))[_0x403e0c(0x1c8)](handleError(_0x2b9d4b,null));},exports[a866_0x4c2da1(0x1d4)]=function(_0x3f764d,_0x21c4b3){const _0x402a3f=a866_0x4c2da1;return db[_0x402a3f(0x1bc)][_0x402a3f(0x1d4)](_0x3f764d[_0x402a3f(0x1b7)],{})[_0x402a3f(0x1bf)](respondWithResult(_0x21c4b3,0xc9))[_0x402a3f(0x1c8)](handleError(_0x21c4b3,null));},exports['update']=function(_0x4e0543,_0xe0ee8d){const _0x36f513=a866_0x4c2da1;return _0x4e0543[_0x36f513(0x1b7)]['id']&&delete _0x4e0543[_0x36f513(0x1b7)]['id'],db[_0x36f513(0x1bc)][_0x36f513(0x1aa)]({'where':{'id':_0x4e0543[_0x36f513(0x1cb)]['id']}})[_0x36f513(0x1bf)](handleEntityNotFound(_0xe0ee8d,null))['then'](saveUpdates(_0x4e0543[_0x36f513(0x1b7)],null))['then'](respondWithResult(_0xe0ee8d,null))['catch'](handleError(_0xe0ee8d,null));},exports[a866_0x4c2da1(0x1ac)]=function(_0x73462f,_0x43efff){const _0x3cbf41=a866_0x4c2da1;return db[_0x3cbf41(0x1bc)][_0x3cbf41(0x1aa)]({'where':{'id':_0x73462f['params']['id']}})[_0x3cbf41(0x1bf)](handleEntityNotFound(_0x43efff,null))[_0x3cbf41(0x1bf)](removeEntity(_0x43efff,null))[_0x3cbf41(0x1c8)](handleError(_0x43efff,null));},exports[a866_0x4c2da1(0x1d5)]=function(_0x5252c3,_0x21811e){const _0x624667=a866_0x4c2da1;return db['VoiceDialReport'][_0x624667(0x1d5)]()['then'](respondWithResult(_0x21811e,null))[_0x624667(0x1c8)](handleError(_0x21811e,null));};