Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / cdr / cdr.controller.js
index 1599d51..ff03308 100644 (file)
@@ -1 +1 @@
-const a51_0x3a87=['update','create','rawAttributes','findOne','body','sequelize','intersection','offset','fieldName','fields','error','order','name','length','pick','count','VIRTUAL','params','status','set','attributes','findAll','include','end','limit','map','merge','filter','model','rows','includeAll','api','undefined','where','../../config/logger','options','sort','keys','catch','filters','then','Cdr','../../components/parsers/qs','describe','query','lodash','type'];(function(_0x3e4a9b,_0x3a87a3){const _0x5a8d1e=function(_0x32228d){while(--_0x32228d){_0x3e4a9b['push'](_0x3e4a9b['shift']());}};_0x5a8d1e(++_0x3a87a3);}(a51_0x3a87,0xed));const a51_0x5a8d=function(_0x3e4a9b,_0x3a87a3){_0x3e4a9b=_0x3e4a9b-0x0;let _0x5a8d1e=a51_0x3a87[_0x3e4a9b];return _0x5a8d1e;};const _0x287482=a51_0x5a8d;'use strict';const _=require(_0x287482('0x2b')),qs=require(_0x287482('0x28')),logger=require(_0x287482('0x20'))(_0x287482('0x1d')),db=require('../../mysqldb')['db'],{Op}=require(_0x287482('0x3'));function respondWithResult(_0x32228d,_0x3ce2c3){return _0x3ce2c3=_0x3ce2c3||0xc8,function(_0x59608f){const _0x3cf4d7=a51_0x5a8d;if(_0x59608f)return _0x32228d[_0x3cf4d7('0x10')](_0x3ce2c3)['json'](_0x59608f);};}function respondWithFilteredResult(_0x1faec1,_0x537a85){return function(_0x2fa65e){const _0xc9788b=a51_0x5a8d;if(_0x2fa65e){const _0x49a47f=_0x2fa65e[_0xc9788b('0xd')],_0x1c6982=_0x537a85[_0xc9788b('0x5')];let _0x4d24d7=_0x537a85[_0xc9788b('0x5')]+_0x537a85[_0xc9788b('0x16')],_0x1551a8;return _0x4d24d7>=_0x49a47f?(_0x4d24d7=_0x49a47f,_0x1551a8=0xc8):_0x1551a8=0xce,_0x1faec1[_0xc9788b('0x10')](_0x1551a8),_0x1faec1[_0xc9788b('0x11')]('Content-Range',_0x1c6982+'-'+_0x4d24d7+'/'+_0x49a47f)['json'](_0x2fa65e);}return null;};}function saveUpdates(_0x17559c){return function(_0x1c9f62){const _0x5549a0=a51_0x5a8d;if(_0x1c9f62)return _0x1c9f62[_0x5549a0('0x2d')](_0x17559c)[_0x5549a0('0x26')](function(_0x1ff6f8){return _0x1ff6f8;});return null;};}function removeEntity(_0x454f8d){return function(_0x5ced60){const _0x3e999d=a51_0x5a8d;if(_0x5ced60)return _0x5ced60['destroy']()[_0x3e999d('0x26')](function(){const _0x5c2651=_0x3e999d;_0x454f8d[_0x5c2651('0x10')](0xcc)[_0x5c2651('0x15')]();});};}function handleEntityNotFound(_0x23f3d8){return function(_0x338772){return!_0x338772&&_0x23f3d8['sendStatus'](0x194),_0x338772;};}function handleError(_0x24a12b,_0x841c1){return _0x841c1=_0x841c1||0x1f4,function(_0x4659ee){const _0x3f9b42=a51_0x5a8d;logger[_0x3f9b42('0x8')](_0x4659ee['stack']),_0x4659ee[_0x3f9b42('0xa')]&&delete _0x4659ee[_0x3f9b42('0xa')],_0x24a12b['status'](_0x841c1)['send'](_0x4659ee);};}exports['index']=function(_0x4214a2,_0x419a42){const _0x3529a2=_0x287482;let _0x12b1ea={};const _0x2b7087={},_0x1c63f6={'count':0x0,'rows':[]},_0x4c965a=_['map'](db['Cdr']['rawAttributes'],function(_0x5a505c){const _0x2d7acb=a51_0x5a8d;return{'name':_0x5a505c[_0x2d7acb('0x6')],'type':_0x5a505c[_0x2d7acb('0x2c')]['key']};});_0x2b7087[_0x3529a2('0x1a')]=_[_0x3529a2('0x17')](_0x4c965a,_0x3529a2('0xa')),_0x2b7087[_0x3529a2('0x2a')]=_[_0x3529a2('0x23')](_0x4214a2[_0x3529a2('0x2a')]),_0x2b7087['filters']=_[_0x3529a2('0x4')](_0x2b7087[_0x3529a2('0x1a')],_0x2b7087[_0x3529a2('0x2a')]),_0x12b1ea[_0x3529a2('0x12')]=_['intersection'](_0x2b7087['model'],qs[_0x3529a2('0x7')](_0x4214a2[_0x3529a2('0x2a')][_0x3529a2('0x7')])),_0x12b1ea[_0x3529a2('0x12')]=_0x12b1ea[_0x3529a2('0x12')][_0x3529a2('0xb')]?_0x12b1ea[_0x3529a2('0x12')]:_0x2b7087[_0x3529a2('0x1a')];typeof _0x4214a2[_0x3529a2('0x2a')]['nolimit']===_0x3529a2('0x1e')&&(_0x12b1ea[_0x3529a2('0x16')]=qs[_0x3529a2('0x16')](_0x4214a2[_0x3529a2('0x2a')]['limit']),_0x12b1ea['offset']=qs[_0x3529a2('0x5')](_0x4214a2['query']['offset']));_0x12b1ea[_0x3529a2('0x9')]=qs[_0x3529a2('0x22')](_0x4214a2[_0x3529a2('0x2a')][_0x3529a2('0x22')]),_0x12b1ea[_0x3529a2('0x1f')]=qs[_0x3529a2('0x25')](_[_0x3529a2('0xc')](_0x4214a2['query'],_0x2b7087[_0x3529a2('0x25')]),_0x4c965a);_0x4214a2[_0x3529a2('0x2a')]['filter']&&(_0x12b1ea[_0x3529a2('0x1f')]=_[_0x3529a2('0x18')](_0x12b1ea[_0x3529a2('0x1f')],{[Op['or']]:_[_0x3529a2('0x17')](_0x4c965a,function(_0x1c1445){const _0x8aca2a=_0x3529a2;if(_0x1c1445[_0x8aca2a('0x2c')]!==_0x8aca2a('0xe')){const _0x5756e9={};return _0x5756e9[_0x1c1445[_0x8aca2a('0xa')]]={[Op['like']]:'%'+_0x4214a2[_0x8aca2a('0x2a')][_0x8aca2a('0x19')]+'%'},_0x5756e9;}})}));_0x12b1ea=_[_0x3529a2('0x18')]({},_0x12b1ea,_0x4214a2[_0x3529a2('0x21')]);const _0x2c7dd2={'where':_0x12b1ea['where']};return db[_0x3529a2('0x27')]['count'](_0x2c7dd2)[_0x3529a2('0x26')](function(_0x102a6b){const _0x591fcf=_0x3529a2;return _0x1c63f6[_0x591fcf('0xd')]=_0x102a6b,_0x4214a2[_0x591fcf('0x2a')][_0x591fcf('0x1c')]&&(_0x12b1ea[_0x591fcf('0x14')]=[{'all':!![]}]),db[_0x591fcf('0x27')][_0x591fcf('0x13')](_0x12b1ea);})[_0x3529a2('0x26')](function(_0x2778d2){const _0x413f66=_0x3529a2;return _0x1c63f6[_0x413f66('0x1b')]=_0x2778d2,_0x1c63f6;})[_0x3529a2('0x26')](respondWithFilteredResult(_0x419a42,_0x12b1ea))['catch'](handleError(_0x419a42,null));},exports['show']=function(_0x13e46e,_0x4f97f2){const _0x6e4ca8=_0x287482;let _0x8460d7={'raw':!![],'where':{'id':_0x13e46e['params']['id']}};const _0x36ce40={};return _0x36ce40[_0x6e4ca8('0x1a')]=_[_0x6e4ca8('0x23')](db[_0x6e4ca8('0x27')][_0x6e4ca8('0x0')]),_0x36ce40[_0x6e4ca8('0x2a')]=_['keys'](_0x13e46e[_0x6e4ca8('0x2a')]),_0x36ce40['filters']=_[_0x6e4ca8('0x4')](_0x36ce40[_0x6e4ca8('0x1a')],_0x36ce40[_0x6e4ca8('0x2a')]),_0x8460d7[_0x6e4ca8('0x12')]=_[_0x6e4ca8('0x4')](_0x36ce40['model'],qs['fields'](_0x13e46e[_0x6e4ca8('0x2a')]['fields'])),_0x8460d7['attributes']=_0x8460d7[_0x6e4ca8('0x12')][_0x6e4ca8('0xb')]?_0x8460d7[_0x6e4ca8('0x12')]:_0x36ce40[_0x6e4ca8('0x1a')],_0x13e46e['query'][_0x6e4ca8('0x1c')]&&(_0x8460d7['include']=[{'all':!![]}]),_0x8460d7=_['merge']({},_0x8460d7,_0x13e46e[_0x6e4ca8('0x21')]),db['Cdr'][_0x6e4ca8('0x1')](_0x8460d7)[_0x6e4ca8('0x26')](handleEntityNotFound(_0x4f97f2,null))['then'](respondWithResult(_0x4f97f2,null))[_0x6e4ca8('0x24')](handleError(_0x4f97f2,null));},exports[_0x287482('0x2e')]=function(_0x4017c1,_0x1bfb70){const _0x31123d=_0x287482;return db[_0x31123d('0x27')]['create'](_0x4017c1[_0x31123d('0x2')],{})['then'](respondWithResult(_0x1bfb70,0xc9))['catch'](handleError(_0x1bfb70,null));},exports['update']=function(_0x32e8f2,_0x53c4f8){const _0x35ed97=_0x287482;return _0x32e8f2[_0x35ed97('0x2')]['id']&&delete _0x32e8f2[_0x35ed97('0x2')]['id'],db[_0x35ed97('0x27')][_0x35ed97('0x1')]({'where':{'id':_0x32e8f2[_0x35ed97('0xf')]['id']}})[_0x35ed97('0x26')](handleEntityNotFound(_0x53c4f8,null))[_0x35ed97('0x26')](saveUpdates(_0x32e8f2[_0x35ed97('0x2')],null))[_0x35ed97('0x26')](respondWithResult(_0x53c4f8,null))[_0x35ed97('0x24')](handleError(_0x53c4f8,null));},exports['destroy']=function(_0x49aebc,_0x83a20){const _0x407e7b=_0x287482;return db[_0x407e7b('0x27')][_0x407e7b('0x1')]({'where':{'id':_0x49aebc['params']['id']}})[_0x407e7b('0x26')](handleEntityNotFound(_0x83a20,null))['then'](removeEntity(_0x83a20,null))[_0x407e7b('0x24')](handleError(_0x83a20,null));},exports[_0x287482('0x29')]=function(_0x2d73b1,_0x4c1452){const _0x3244e6=_0x287482;return db[_0x3244e6('0x27')][_0x3244e6('0x29')]()[_0x3244e6('0x26')](respondWithResult(_0x4c1452,null))['catch'](handleError(_0x4c1452,null));};
\ No newline at end of file
+const a51_0x32d1=['destroy','length','offset','count','include','../../mysqldb','send','json','undefined','sort','../../components/parsers/qs','describe','like','then','end','query','filters','model','options','fields','attributes','name','includeAll','body','create','rawAttributes','params','sequelize','status','api','update','set','findOne','intersection','limit','key','sendStatus','catch','Content-Range','merge','error','map','order','fieldName','findAll','../../config/logger','type','filter','VIRTUAL','nolimit','Cdr','where'];(function(_0x5a0e19,_0x32d1b4){const _0x49315a=function(_0x3fcc63){while(--_0x3fcc63){_0x5a0e19['push'](_0x5a0e19['shift']());}};_0x49315a(++_0x32d1b4);}(a51_0x32d1,0x131));const a51_0x4931=function(_0x5a0e19,_0x32d1b4){_0x5a0e19=_0x5a0e19-0x0;let _0x49315a=a51_0x32d1[_0x5a0e19];return _0x49315a;};const _0x3e48c2=a51_0x4931;'use strict';const _=require('lodash'),qs=require(_0x3e48c2('0x11')),logger=require(_0x3e48c2('0x0'))(_0x3e48c2('0x24')),db=require(_0x3e48c2('0xc'))['db'],{Op}=require(_0x3e48c2('0x22'));function respondWithResult(_0x3fcc63,_0x7c3b15){return _0x7c3b15=_0x7c3b15||0xc8,function(_0xc9b01f){const _0x2bf81e=a51_0x4931;if(_0xc9b01f)return _0x3fcc63[_0x2bf81e('0x23')](_0x7c3b15)['json'](_0xc9b01f);};}function respondWithFilteredResult(_0x13a1b4,_0xcd2612){return function(_0x2675e5){const _0x3e0926=a51_0x4931;if(_0x2675e5){const _0x2d0a84=_0x2675e5[_0x3e0926('0xa')],_0x5629d7=_0xcd2612[_0x3e0926('0x9')];let _0x47c01e=_0xcd2612['offset']+_0xcd2612['limit'],_0x291275;return _0x47c01e>=_0x2d0a84?(_0x47c01e=_0x2d0a84,_0x291275=0xc8):_0x291275=0xce,_0x13a1b4[_0x3e0926('0x23')](_0x291275),_0x13a1b4[_0x3e0926('0x26')](_0x3e0926('0x2d'),_0x5629d7+'-'+_0x47c01e+'/'+_0x2d0a84)[_0x3e0926('0xe')](_0x2675e5);}return null;};}function saveUpdates(_0x43035c){return function(_0x5dac86){const _0x5a85fe=a51_0x4931;if(_0x5dac86)return _0x5dac86[_0x5a85fe('0x25')](_0x43035c)['then'](function(_0x15b146){return _0x15b146;});return null;};}function removeEntity(_0x37a85f){return function(_0x21bf03){const _0xbfb675=a51_0x4931;if(_0x21bf03)return _0x21bf03[_0xbfb675('0x7')]()[_0xbfb675('0x14')](function(){const _0x2a1528=_0xbfb675;_0x37a85f[_0x2a1528('0x23')](0xcc)[_0x2a1528('0x15')]();});};}function handleEntityNotFound(_0x51775d){return function(_0x155a32){const _0xa111bc=a51_0x4931;return!_0x155a32&&_0x51775d[_0xa111bc('0x2b')](0x194),_0x155a32;};}function handleError(_0xca808e,_0x54d5ba){return _0x54d5ba=_0x54d5ba||0x1f4,function(_0x19f779){const _0x54e73e=a51_0x4931;logger[_0x54e73e('0x2f')](_0x19f779['stack']),_0x19f779[_0x54e73e('0x1c')]&&delete _0x19f779[_0x54e73e('0x1c')],_0xca808e[_0x54e73e('0x23')](_0x54d5ba)[_0x54e73e('0xd')](_0x19f779);};}exports['index']=function(_0x59d2a6,_0x214aa1){const _0xd6fd6e=_0x3e48c2;let _0x35d762={};const _0x2e33a5={},_0x7761a1={'count':0x0,'rows':[]},_0x129c84=_[_0xd6fd6e('0x30')](db['Cdr'][_0xd6fd6e('0x20')],function(_0x268a3b){const _0x58dc85=_0xd6fd6e;return{'name':_0x268a3b[_0x58dc85('0x32')],'type':_0x268a3b[_0x58dc85('0x1')][_0x58dc85('0x2a')]};});_0x2e33a5[_0xd6fd6e('0x18')]=_[_0xd6fd6e('0x30')](_0x129c84,_0xd6fd6e('0x1c')),_0x2e33a5[_0xd6fd6e('0x16')]=_['keys'](_0x59d2a6[_0xd6fd6e('0x16')]),_0x2e33a5['filters']=_[_0xd6fd6e('0x28')](_0x2e33a5[_0xd6fd6e('0x18')],_0x2e33a5[_0xd6fd6e('0x16')]),_0x35d762[_0xd6fd6e('0x1b')]=_['intersection'](_0x2e33a5[_0xd6fd6e('0x18')],qs[_0xd6fd6e('0x1a')](_0x59d2a6[_0xd6fd6e('0x16')][_0xd6fd6e('0x1a')])),_0x35d762[_0xd6fd6e('0x1b')]=_0x35d762['attributes']['length']?_0x35d762[_0xd6fd6e('0x1b')]:_0x2e33a5[_0xd6fd6e('0x18')];typeof _0x59d2a6[_0xd6fd6e('0x16')][_0xd6fd6e('0x4')]===_0xd6fd6e('0xf')&&(_0x35d762[_0xd6fd6e('0x29')]=qs['limit'](_0x59d2a6['query'][_0xd6fd6e('0x29')]),_0x35d762['offset']=qs[_0xd6fd6e('0x9')](_0x59d2a6['query'][_0xd6fd6e('0x9')]));_0x35d762[_0xd6fd6e('0x31')]=qs[_0xd6fd6e('0x10')](_0x59d2a6[_0xd6fd6e('0x16')][_0xd6fd6e('0x10')]),_0x35d762[_0xd6fd6e('0x6')]=qs[_0xd6fd6e('0x17')](_['pick'](_0x59d2a6[_0xd6fd6e('0x16')],_0x2e33a5['filters']),_0x129c84);_0x59d2a6[_0xd6fd6e('0x16')][_0xd6fd6e('0x2')]&&(_0x35d762[_0xd6fd6e('0x6')]=_[_0xd6fd6e('0x2e')](_0x35d762['where'],{[Op['or']]:_['map'](_0x129c84,function(_0x4032a1){const _0x3a3b24=_0xd6fd6e;if(_0x4032a1[_0x3a3b24('0x1')]!==_0x3a3b24('0x3')){const _0x18a415={};return _0x18a415[_0x4032a1['name']]={[Op[_0x3a3b24('0x13')]]:'%'+_0x59d2a6[_0x3a3b24('0x16')][_0x3a3b24('0x2')]+'%'},_0x18a415;}})}));_0x35d762=_['merge']({},_0x35d762,_0x59d2a6[_0xd6fd6e('0x19')]);const _0x578dc9={'where':_0x35d762[_0xd6fd6e('0x6')]};return db[_0xd6fd6e('0x5')]['count'](_0x578dc9)[_0xd6fd6e('0x14')](function(_0x19668a){const _0xad2e73=_0xd6fd6e;return _0x7761a1[_0xad2e73('0xa')]=_0x19668a,_0x59d2a6[_0xad2e73('0x16')]['includeAll']&&(_0x35d762[_0xad2e73('0xb')]=[{'all':!![]}]),db[_0xad2e73('0x5')][_0xad2e73('0x33')](_0x35d762);})['then'](function(_0x344efe){return _0x7761a1['rows']=_0x344efe,_0x7761a1;})['then'](respondWithFilteredResult(_0x214aa1,_0x35d762))[_0xd6fd6e('0x2c')](handleError(_0x214aa1,null));},exports['show']=function(_0x226620,_0x3a03a7){const _0x22d10a=_0x3e48c2;let _0x59b76e={'raw':!![],'where':{'id':_0x226620[_0x22d10a('0x21')]['id']}};const _0x13dd84={};return _0x13dd84['model']=_['keys'](db[_0x22d10a('0x5')][_0x22d10a('0x20')]),_0x13dd84[_0x22d10a('0x16')]=_['keys'](_0x226620[_0x22d10a('0x16')]),_0x13dd84['filters']=_[_0x22d10a('0x28')](_0x13dd84[_0x22d10a('0x18')],_0x13dd84[_0x22d10a('0x16')]),_0x59b76e['attributes']=_[_0x22d10a('0x28')](_0x13dd84[_0x22d10a('0x18')],qs[_0x22d10a('0x1a')](_0x226620['query'][_0x22d10a('0x1a')])),_0x59b76e['attributes']=_0x59b76e[_0x22d10a('0x1b')][_0x22d10a('0x8')]?_0x59b76e[_0x22d10a('0x1b')]:_0x13dd84[_0x22d10a('0x18')],_0x226620[_0x22d10a('0x16')][_0x22d10a('0x1d')]&&(_0x59b76e[_0x22d10a('0xb')]=[{'all':!![]}]),_0x59b76e=_[_0x22d10a('0x2e')]({},_0x59b76e,_0x226620[_0x22d10a('0x19')]),db[_0x22d10a('0x5')][_0x22d10a('0x27')](_0x59b76e)[_0x22d10a('0x14')](handleEntityNotFound(_0x3a03a7,null))['then'](respondWithResult(_0x3a03a7,null))['catch'](handleError(_0x3a03a7,null));},exports[_0x3e48c2('0x1f')]=function(_0x13a4b1,_0xd2f516){const _0x4dfa1f=_0x3e48c2;return db[_0x4dfa1f('0x5')]['create'](_0x13a4b1[_0x4dfa1f('0x1e')],{})[_0x4dfa1f('0x14')](respondWithResult(_0xd2f516,0xc9))[_0x4dfa1f('0x2c')](handleError(_0xd2f516,null));},exports[_0x3e48c2('0x25')]=function(_0x304ac3,_0x433498){const _0x4e47a8=_0x3e48c2;return _0x304ac3[_0x4e47a8('0x1e')]['id']&&delete _0x304ac3[_0x4e47a8('0x1e')]['id'],db[_0x4e47a8('0x5')][_0x4e47a8('0x27')]({'where':{'id':_0x304ac3['params']['id']}})[_0x4e47a8('0x14')](handleEntityNotFound(_0x433498,null))[_0x4e47a8('0x14')](saveUpdates(_0x304ac3[_0x4e47a8('0x1e')],null))[_0x4e47a8('0x14')](respondWithResult(_0x433498,null))['catch'](handleError(_0x433498,null));},exports[_0x3e48c2('0x7')]=function(_0x548194,_0x394a35){const _0x30e50e=_0x3e48c2;return db[_0x30e50e('0x5')][_0x30e50e('0x27')]({'where':{'id':_0x548194[_0x30e50e('0x21')]['id']}})[_0x30e50e('0x14')](handleEntityNotFound(_0x394a35,null))[_0x30e50e('0x14')](removeEntity(_0x394a35,null))[_0x30e50e('0x2c')](handleError(_0x394a35,null));},exports[_0x3e48c2('0x12')]=function(_0x204a81,_0xc4fbd8){const _0x3f6cbb=_0x3e48c2;return db[_0x3f6cbb('0x5')][_0x3f6cbb('0x12')]()[_0x3f6cbb('0x14')](respondWithResult(_0xc4fbd8,null))[_0x3f6cbb('0x2c')](handleError(_0xc4fbd8,null));};
\ No newline at end of file