Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / voiceDialReport / voiceDialReport.controller.js
1 const a722_0x3020=['../../components/parsers/qs','send','offset','key','end','findAll','merge','findOne','fields','sendStatus','body','filters','../../mysqldb','attributes','model','params','intersection','rawAttributes','update','keys','limit','then','VoiceDialReport','json','pick','like','create','rows','sequelize','catch','length','set','filter','VIRTUAL','show','lodash','status','name','../../config/logger','type','count','destroy','error','query','map','stack','where','options','sort'];(function(_0x1be833,_0x30200c){const _0x567dc0=function(_0x2aa708){while(--_0x2aa708){_0x1be833['push'](_0x1be833['shift']());}};_0x567dc0(++_0x30200c);}(a722_0x3020,0x19a));const a722_0x567d=function(_0x1be833,_0x30200c){_0x1be833=_0x1be833-0x0;let _0x567dc0=a722_0x3020[_0x1be833];return _0x567dc0;};const _0x3950c8=a722_0x567d;'use strict';const _=require(_0x3950c8('0x11')),qs=require(_0x3950c8('0x1f')),logger=require(_0x3950c8('0x14'))('api'),db=require(_0x3950c8('0x2b'))['db'],{Op}=require(_0x3950c8('0xa'));function respondWithResult(_0x2aa708,_0x490be1){return _0x490be1=_0x490be1||0xc8,function(_0x1cdd52){const _0x34db48=a722_0x567d;if(_0x1cdd52)return _0x2aa708[_0x34db48('0x12')](_0x490be1)[_0x34db48('0x5')](_0x1cdd52);};}function respondWithFilteredResult(_0x17e0bb,_0x35bea2){return function(_0x4918c3){const _0x37a9ca=a722_0x567d;if(_0x4918c3){const _0x58893d=_0x4918c3[_0x37a9ca('0x16')],_0x369459=_0x35bea2[_0x37a9ca('0x21')];let _0x50954b=_0x35bea2[_0x37a9ca('0x21')]+_0x35bea2[_0x37a9ca('0x2')],_0x2bd5ea;return _0x50954b>=_0x58893d?(_0x50954b=_0x58893d,_0x2bd5ea=0xc8):_0x2bd5ea=0xce,_0x17e0bb['status'](_0x2bd5ea),_0x17e0bb[_0x37a9ca('0xd')]('Content-Range',_0x369459+'-'+_0x50954b+'/'+_0x58893d)[_0x37a9ca('0x5')](_0x4918c3);}return null;};}function saveUpdates(_0x3ca388){return function(_0x55636e){const _0x2374f8=a722_0x567d;if(_0x55636e)return _0x55636e[_0x2374f8('0x0')](_0x3ca388)[_0x2374f8('0x3')](function(_0x4bbdae){return _0x4bbdae;});return null;};}function removeEntity(_0x22400f){return function(_0xdd978e){const _0x443ecf=a722_0x567d;if(_0xdd978e)return _0xdd978e[_0x443ecf('0x17')]()['then'](function(){const _0x6345e2=_0x443ecf;_0x22400f[_0x6345e2('0x12')](0xcc)[_0x6345e2('0x23')]();});};}function handleEntityNotFound(_0x541a38){return function(_0x393871){const _0x3dbdc6=a722_0x567d;return!_0x393871&&_0x541a38[_0x3dbdc6('0x28')](0x194),_0x393871;};}function handleError(_0x50cc3a,_0x3bf285){return _0x3bf285=_0x3bf285||0x1f4,function(_0x303adb){const _0x2fdd36=a722_0x567d;logger[_0x2fdd36('0x18')](_0x303adb[_0x2fdd36('0x1b')]),_0x303adb[_0x2fdd36('0x13')]&&delete _0x303adb['name'],_0x50cc3a[_0x2fdd36('0x12')](_0x3bf285)[_0x2fdd36('0x20')](_0x303adb);};}exports['index']=function(_0x16b746,_0x59b8bf){const _0x1df983=_0x3950c8;let _0x365d46={};const _0x34900b={},_0x54c37a={'count':0x0,'rows':[]},_0x349530=_['map'](db[_0x1df983('0x4')]['rawAttributes'],function(_0x3e6229){const _0x154eb9=_0x1df983;return{'name':_0x3e6229['fieldName'],'type':_0x3e6229[_0x154eb9('0x15')][_0x154eb9('0x22')]};});_0x34900b['model']=_[_0x1df983('0x1a')](_0x349530,'name'),_0x34900b['query']=_[_0x1df983('0x1')](_0x16b746[_0x1df983('0x19')]),_0x34900b[_0x1df983('0x2a')]=_[_0x1df983('0x2f')](_0x34900b[_0x1df983('0x2d')],_0x34900b[_0x1df983('0x19')]),_0x365d46[_0x1df983('0x2c')]=_['intersection'](_0x34900b[_0x1df983('0x2d')],qs[_0x1df983('0x27')](_0x16b746[_0x1df983('0x19')][_0x1df983('0x27')])),_0x365d46['attributes']=_0x365d46['attributes'][_0x1df983('0xc')]?_0x365d46[_0x1df983('0x2c')]:_0x34900b[_0x1df983('0x2d')];typeof _0x16b746[_0x1df983('0x19')]['nolimit']==='undefined'&&(_0x365d46[_0x1df983('0x2')]=qs[_0x1df983('0x2')](_0x16b746['query'][_0x1df983('0x2')]),_0x365d46[_0x1df983('0x21')]=qs[_0x1df983('0x21')](_0x16b746['query'][_0x1df983('0x21')]));_0x365d46['order']=qs['sort'](_0x16b746[_0x1df983('0x19')][_0x1df983('0x1e')]),_0x365d46[_0x1df983('0x1c')]=qs['filters'](_[_0x1df983('0x6')](_0x16b746[_0x1df983('0x19')],_0x34900b[_0x1df983('0x2a')]),_0x349530);_0x16b746['query'][_0x1df983('0xe')]&&(_0x365d46['where']=_[_0x1df983('0x25')](_0x365d46[_0x1df983('0x1c')],{[Op['or']]:_[_0x1df983('0x1a')](_0x349530,function(_0x2b111a){const _0x2aec66=_0x1df983;if(_0x2b111a['type']!==_0x2aec66('0xf')){const _0x28c594={};return _0x28c594[_0x2b111a['name']]={[Op[_0x2aec66('0x7')]]:'%'+_0x16b746[_0x2aec66('0x19')]['filter']+'%'},_0x28c594;}})}));_0x365d46=_[_0x1df983('0x25')]({},_0x365d46,_0x16b746[_0x1df983('0x1d')]);const _0x225f8d={'where':_0x365d46[_0x1df983('0x1c')]};return db['VoiceDialReport']['count'](_0x225f8d)[_0x1df983('0x3')](function(_0x50b797){const _0x1bf4dd=_0x1df983;return _0x54c37a['count']=_0x50b797,_0x16b746['query']['includeAll']&&(_0x365d46['include']=[{'all':!![]}]),db[_0x1bf4dd('0x4')][_0x1bf4dd('0x24')](_0x365d46);})['then'](function(_0x2a9bf1){const _0x22c6a6=_0x1df983;return _0x54c37a[_0x22c6a6('0x9')]=_0x2a9bf1,_0x54c37a;})[_0x1df983('0x3')](respondWithFilteredResult(_0x59b8bf,_0x365d46))[_0x1df983('0xb')](handleError(_0x59b8bf,null));},exports[_0x3950c8('0x10')]=function(_0x98d50d,_0x3cc4f9){const _0x4eeb85=_0x3950c8;let _0x59d26c={'raw':!![],'where':{'id':_0x98d50d[_0x4eeb85('0x2e')]['id']}};const _0x16c87d={};return _0x16c87d[_0x4eeb85('0x2d')]=_[_0x4eeb85('0x1')](db['VoiceDialReport'][_0x4eeb85('0x30')]),_0x16c87d[_0x4eeb85('0x19')]=_[_0x4eeb85('0x1')](_0x98d50d[_0x4eeb85('0x19')]),_0x16c87d[_0x4eeb85('0x2a')]=_[_0x4eeb85('0x2f')](_0x16c87d[_0x4eeb85('0x2d')],_0x16c87d[_0x4eeb85('0x19')]),_0x59d26c[_0x4eeb85('0x2c')]=_[_0x4eeb85('0x2f')](_0x16c87d[_0x4eeb85('0x2d')],qs[_0x4eeb85('0x27')](_0x98d50d[_0x4eeb85('0x19')][_0x4eeb85('0x27')])),_0x59d26c[_0x4eeb85('0x2c')]=_0x59d26c['attributes'][_0x4eeb85('0xc')]?_0x59d26c['attributes']:_0x16c87d['model'],_0x98d50d['query']['includeAll']&&(_0x59d26c['include']=[{'all':!![]}]),_0x59d26c=_[_0x4eeb85('0x25')]({},_0x59d26c,_0x98d50d[_0x4eeb85('0x1d')]),db[_0x4eeb85('0x4')]['findOne'](_0x59d26c)[_0x4eeb85('0x3')](handleEntityNotFound(_0x3cc4f9,null))[_0x4eeb85('0x3')](respondWithResult(_0x3cc4f9,null))[_0x4eeb85('0xb')](handleError(_0x3cc4f9,null));},exports[_0x3950c8('0x8')]=function(_0x350363,_0x4298d1){const _0x119696=_0x3950c8;return db[_0x119696('0x4')][_0x119696('0x8')](_0x350363['body'],{})[_0x119696('0x3')](respondWithResult(_0x4298d1,0xc9))['catch'](handleError(_0x4298d1,null));},exports[_0x3950c8('0x0')]=function(_0x41d811,_0x2d9a6a){const _0x307a29=_0x3950c8;return _0x41d811[_0x307a29('0x29')]['id']&&delete _0x41d811[_0x307a29('0x29')]['id'],db[_0x307a29('0x4')][_0x307a29('0x26')]({'where':{'id':_0x41d811[_0x307a29('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2d9a6a,null))[_0x307a29('0x3')](saveUpdates(_0x41d811[_0x307a29('0x29')],null))[_0x307a29('0x3')](respondWithResult(_0x2d9a6a,null))[_0x307a29('0xb')](handleError(_0x2d9a6a,null));},exports['destroy']=function(_0x834b4b,_0x2c6f7d){const _0x3ebbd9=_0x3950c8;return db[_0x3ebbd9('0x4')]['findOne']({'where':{'id':_0x834b4b[_0x3ebbd9('0x2e')]['id']}})[_0x3ebbd9('0x3')](handleEntityNotFound(_0x2c6f7d,null))[_0x3ebbd9('0x3')](removeEntity(_0x2c6f7d,null))[_0x3ebbd9('0xb')](handleError(_0x2c6f7d,null));},exports['describe']=function(_0x3c7e71,_0x7e584e){const _0x3bbc7e=_0x3950c8;return db[_0x3bbc7e('0x4')]['describe']()[_0x3bbc7e('0x3')](respondWithResult(_0x7e584e,null))[_0x3bbc7e('0xb')](handleError(_0x7e584e,null));};