Built motion from commit bfc7a72f7045b27461c9a5d1f71c1a658cfd0b8b. Version 3.0.0...
[motion-next.git] / server / api / voiceDialReport / voiceDialReport.controller.js
1 const a722_0x5b49=['includeAll','stack','intersection','rawAttributes','json','fieldName','count','show','describe','VIRTUAL','rows','end','key','sequelize','query','order','merge','send','attributes','lodash','map','keys','create','length','findOne','../../config/logger','destroy','catch','params','then','name','error','status','sort','undefined','type','sendStatus','include','offset','body','VoiceDialReport','limit','pick','model','options','filter','filters','fields','where','set','Content-Range'];(function(_0x79e4fa,_0x5b49ca){const _0x3ec2ed=function(_0x44bcfe){while(--_0x44bcfe){_0x79e4fa['push'](_0x79e4fa['shift']());}};_0x3ec2ed(++_0x5b49ca);}(a722_0x5b49,0x179));const a722_0x3ec2=function(_0x79e4fa,_0x5b49ca){_0x79e4fa=_0x79e4fa-0x0;let _0x3ec2ed=a722_0x5b49[_0x79e4fa];return _0x3ec2ed;};const _0x2b8652=a722_0x3ec2;'use strict';const _=require(_0x2b8652('0x32')),qs=require('../../components/parsers/qs'),logger=require(_0x2b8652('0x5'))('api'),db=require('../../mysqldb')['db'],{Op}=require(_0x2b8652('0x2c'));function respondWithResult(_0x44bcfe,_0x40f4a9){return _0x40f4a9=_0x40f4a9||0xc8,function(_0x13ffe8){const _0x5770ba=a722_0x3ec2;if(_0x13ffe8)return _0x44bcfe[_0x5770ba('0xc')](_0x40f4a9)[_0x5770ba('0x23')](_0x13ffe8);};}function respondWithFilteredResult(_0x498739,_0x1ceceb){return function(_0x148253){const _0xb4f1c3=a722_0x3ec2;if(_0x148253){const _0x428695=_0x148253['count'],_0x7e18bc=_0x1ceceb[_0xb4f1c3('0x12')];let _0xb8d444=_0x1ceceb[_0xb4f1c3('0x12')]+_0x1ceceb[_0xb4f1c3('0x15')],_0x11871d;return _0xb8d444>=_0x428695?(_0xb8d444=_0x428695,_0x11871d=0xc8):_0x11871d=0xce,_0x498739[_0xb4f1c3('0xc')](_0x11871d),_0x498739[_0xb4f1c3('0x1d')](_0xb4f1c3('0x1e'),_0x7e18bc+'-'+_0xb8d444+'/'+_0x428695)[_0xb4f1c3('0x23')](_0x148253);}return null;};}function saveUpdates(_0x25ff59){return function(_0x2065d4){const _0x574bec=a722_0x3ec2;if(_0x2065d4)return _0x2065d4['update'](_0x25ff59)[_0x574bec('0x9')](function(_0x4fe7e5){return _0x4fe7e5;});return null;};}function removeEntity(_0x2531dd){return function(_0x526170){const _0x35e548=a722_0x3ec2;if(_0x526170)return _0x526170['destroy']()[_0x35e548('0x9')](function(){const _0xb593c6=_0x35e548;_0x2531dd['status'](0xcc)[_0xb593c6('0x2a')]();});};}function handleEntityNotFound(_0x223987){return function(_0x4e68a0){const _0x104328=a722_0x3ec2;return!_0x4e68a0&&_0x223987[_0x104328('0x10')](0x194),_0x4e68a0;};}function handleError(_0x3b89c4,_0x3ee0d0){return _0x3ee0d0=_0x3ee0d0||0x1f4,function(_0x59b491){const _0xd265ca=a722_0x3ec2;logger[_0xd265ca('0xb')](_0x59b491[_0xd265ca('0x20')]),_0x59b491[_0xd265ca('0xa')]&&delete _0x59b491[_0xd265ca('0xa')],_0x3b89c4[_0xd265ca('0xc')](_0x3ee0d0)[_0xd265ca('0x30')](_0x59b491);};}exports['index']=function(_0x1decc7,_0x21ee88){const _0x2db050=_0x2b8652;let _0x549a58={};const _0x34d897={},_0x29f6f8={'count':0x0,'rows':[]},_0x3e6e47=_[_0x2db050('0x0')](db[_0x2db050('0x14')][_0x2db050('0x22')],function(_0x21761e){const _0x5b6ebd=_0x2db050;return{'name':_0x21761e[_0x5b6ebd('0x24')],'type':_0x21761e[_0x5b6ebd('0xf')][_0x5b6ebd('0x2b')]};});_0x34d897[_0x2db050('0x17')]=_[_0x2db050('0x0')](_0x3e6e47,_0x2db050('0xa')),_0x34d897[_0x2db050('0x2d')]=_[_0x2db050('0x1')](_0x1decc7['query']),_0x34d897['filters']=_[_0x2db050('0x21')](_0x34d897[_0x2db050('0x17')],_0x34d897[_0x2db050('0x2d')]),_0x549a58[_0x2db050('0x31')]=_[_0x2db050('0x21')](_0x34d897[_0x2db050('0x17')],qs[_0x2db050('0x1b')](_0x1decc7[_0x2db050('0x2d')][_0x2db050('0x1b')])),_0x549a58[_0x2db050('0x31')]=_0x549a58[_0x2db050('0x31')][_0x2db050('0x3')]?_0x549a58[_0x2db050('0x31')]:_0x34d897['model'];typeof _0x1decc7[_0x2db050('0x2d')]['nolimit']===_0x2db050('0xe')&&(_0x549a58[_0x2db050('0x15')]=qs['limit'](_0x1decc7[_0x2db050('0x2d')][_0x2db050('0x15')]),_0x549a58[_0x2db050('0x12')]=qs[_0x2db050('0x12')](_0x1decc7[_0x2db050('0x2d')][_0x2db050('0x12')]));_0x549a58[_0x2db050('0x2e')]=qs[_0x2db050('0xd')](_0x1decc7['query'][_0x2db050('0xd')]),_0x549a58[_0x2db050('0x1c')]=qs[_0x2db050('0x1a')](_[_0x2db050('0x16')](_0x1decc7[_0x2db050('0x2d')],_0x34d897['filters']),_0x3e6e47);_0x1decc7[_0x2db050('0x2d')]['filter']&&(_0x549a58[_0x2db050('0x1c')]=_[_0x2db050('0x2f')](_0x549a58['where'],{[Op['or']]:_[_0x2db050('0x0')](_0x3e6e47,function(_0x35f34b){const _0x447e93=_0x2db050;if(_0x35f34b[_0x447e93('0xf')]!==_0x447e93('0x28')){const _0x3458be={};return _0x3458be[_0x35f34b[_0x447e93('0xa')]]={[Op['like']]:'%'+_0x1decc7[_0x447e93('0x2d')][_0x447e93('0x19')]+'%'},_0x3458be;}})}));_0x549a58=_['merge']({},_0x549a58,_0x1decc7['options']);const _0x18c69b={'where':_0x549a58[_0x2db050('0x1c')]};return db[_0x2db050('0x14')][_0x2db050('0x25')](_0x18c69b)[_0x2db050('0x9')](function(_0x3658df){const _0x21fe5a=_0x2db050;return _0x29f6f8['count']=_0x3658df,_0x1decc7[_0x21fe5a('0x2d')][_0x21fe5a('0x1f')]&&(_0x549a58[_0x21fe5a('0x11')]=[{'all':!![]}]),db[_0x21fe5a('0x14')]['findAll'](_0x549a58);})[_0x2db050('0x9')](function(_0x1a6e71){const _0xfdc222=_0x2db050;return _0x29f6f8[_0xfdc222('0x29')]=_0x1a6e71,_0x29f6f8;})['then'](respondWithFilteredResult(_0x21ee88,_0x549a58))[_0x2db050('0x7')](handleError(_0x21ee88,null));},exports[_0x2b8652('0x26')]=function(_0xa74fcd,_0x53eac0){const _0x178692=_0x2b8652;let _0x41dc4e={'raw':!![],'where':{'id':_0xa74fcd[_0x178692('0x8')]['id']}};const _0x1bc81b={};return _0x1bc81b['model']=_['keys'](db[_0x178692('0x14')][_0x178692('0x22')]),_0x1bc81b[_0x178692('0x2d')]=_[_0x178692('0x1')](_0xa74fcd['query']),_0x1bc81b[_0x178692('0x1a')]=_[_0x178692('0x21')](_0x1bc81b[_0x178692('0x17')],_0x1bc81b[_0x178692('0x2d')]),_0x41dc4e[_0x178692('0x31')]=_[_0x178692('0x21')](_0x1bc81b[_0x178692('0x17')],qs[_0x178692('0x1b')](_0xa74fcd['query']['fields'])),_0x41dc4e['attributes']=_0x41dc4e[_0x178692('0x31')][_0x178692('0x3')]?_0x41dc4e[_0x178692('0x31')]:_0x1bc81b[_0x178692('0x17')],_0xa74fcd['query'][_0x178692('0x1f')]&&(_0x41dc4e[_0x178692('0x11')]=[{'all':!![]}]),_0x41dc4e=_[_0x178692('0x2f')]({},_0x41dc4e,_0xa74fcd[_0x178692('0x18')]),db['VoiceDialReport'][_0x178692('0x4')](_0x41dc4e)[_0x178692('0x9')](handleEntityNotFound(_0x53eac0,null))[_0x178692('0x9')](respondWithResult(_0x53eac0,null))[_0x178692('0x7')](handleError(_0x53eac0,null));},exports[_0x2b8652('0x2')]=function(_0x244e6c,_0x14e95f){const _0x1172ab=_0x2b8652;return db[_0x1172ab('0x14')][_0x1172ab('0x2')](_0x244e6c[_0x1172ab('0x13')],{})[_0x1172ab('0x9')](respondWithResult(_0x14e95f,0xc9))['catch'](handleError(_0x14e95f,null));},exports['update']=function(_0x5e129a,_0x1ba7c7){const _0x2230bb=_0x2b8652;return _0x5e129a[_0x2230bb('0x13')]['id']&&delete _0x5e129a[_0x2230bb('0x13')]['id'],db[_0x2230bb('0x14')][_0x2230bb('0x4')]({'where':{'id':_0x5e129a[_0x2230bb('0x8')]['id']}})[_0x2230bb('0x9')](handleEntityNotFound(_0x1ba7c7,null))[_0x2230bb('0x9')](saveUpdates(_0x5e129a[_0x2230bb('0x13')],null))[_0x2230bb('0x9')](respondWithResult(_0x1ba7c7,null))[_0x2230bb('0x7')](handleError(_0x1ba7c7,null));},exports[_0x2b8652('0x6')]=function(_0x1a0b46,_0x4386b8){const _0x217416=_0x2b8652;return db['VoiceDialReport'][_0x217416('0x4')]({'where':{'id':_0x1a0b46[_0x217416('0x8')]['id']}})[_0x217416('0x9')](handleEntityNotFound(_0x4386b8,null))['then'](removeEntity(_0x4386b8,null))[_0x217416('0x7')](handleError(_0x4386b8,null));},exports[_0x2b8652('0x27')]=function(_0x192905,_0x24ea9a){const _0x4f4081=_0x2b8652;return db[_0x4f4081('0x14')][_0x4f4081('0x27')]()['then'](respondWithResult(_0x24ea9a,null))[_0x4f4081('0x7')](handleError(_0x24ea9a,null));};