Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / voiceQueuesLog / voiceQueuesLog.controller.js
1 const a767_0x4367=['update','like','VoiceQueuesLog','limit','pick','query','merge','status','options','order','sequelize','error','type','findAll','body','filter','attributes','fields','catch','name','set','where','intersection','json','params','../../mysqldb','count','Content-Range','fieldName','length','rawAttributes','offset','nolimit','model','map','keys','create','destroy','undefined','../../config/logger','then','end','key','include','filters','includeAll','VIRTUAL','lodash','sort','findOne','show','stack'];(function(_0x500258,_0x436772){const _0x537d0=function(_0x2bf177){while(--_0x2bf177){_0x500258['push'](_0x500258['shift']());}};_0x537d0(++_0x436772);}(a767_0x4367,0xb5));const a767_0x537d=function(_0x500258,_0x436772){_0x500258=_0x500258-0x0;let _0x537d0=a767_0x4367[_0x500258];return _0x537d0;};const _0xca90e2=a767_0x537d;'use strict';const _=require(_0xca90e2('0x16')),qs=require('../../components/parsers/qs'),logger=require(_0xca90e2('0xe'))('api'),db=require(_0xca90e2('0x0'))['db'],{Op}=require(_0xca90e2('0x25'));function respondWithResult(_0x2bf177,_0x2dbd7a){return _0x2dbd7a=_0x2dbd7a||0xc8,function(_0x4cf2e3){const _0x2538fc=a767_0x537d;if(_0x4cf2e3)return _0x2bf177['status'](_0x2dbd7a)[_0x2538fc('0x32')](_0x4cf2e3);};}function respondWithFilteredResult(_0x25ead3,_0x14e27f){return function(_0x45b734){const _0x1f0e2d=a767_0x537d;if(_0x45b734){const _0x5c3608=_0x45b734['count'],_0x5a276b=_0x14e27f[_0x1f0e2d('0x6')];let _0xd8e720=_0x14e27f[_0x1f0e2d('0x6')]+_0x14e27f['limit'],_0x53449c;return _0xd8e720>=_0x5c3608?(_0xd8e720=_0x5c3608,_0x53449c=0xc8):_0x53449c=0xce,_0x25ead3[_0x1f0e2d('0x22')](_0x53449c),_0x25ead3[_0x1f0e2d('0x2f')](_0x1f0e2d('0x2'),_0x5a276b+'-'+_0xd8e720+'/'+_0x5c3608)['json'](_0x45b734);}return null;};}function saveUpdates(_0x35f050){return function(_0x501c69){const _0x35ecdf=a767_0x537d;if(_0x501c69)return _0x501c69[_0x35ecdf('0x1b')](_0x35f050)[_0x35ecdf('0xf')](function(_0x187b02){return _0x187b02;});return null;};}function removeEntity(_0x26871e){return function(_0x448a08){const _0x46b5b2=a767_0x537d;if(_0x448a08)return _0x448a08['destroy']()[_0x46b5b2('0xf')](function(){const _0x30e547=_0x46b5b2;_0x26871e[_0x30e547('0x22')](0xcc)[_0x30e547('0x10')]();});};}function handleEntityNotFound(_0x5250f2){return function(_0x117497){return!_0x117497&&_0x5250f2['sendStatus'](0x194),_0x117497;};}function handleError(_0x27ff31,_0x20f482){return _0x20f482=_0x20f482||0x1f4,function(_0x5448f0){const _0x533961=a767_0x537d;logger[_0x533961('0x26')](_0x5448f0[_0x533961('0x1a')]),_0x5448f0['name']&&delete _0x5448f0[_0x533961('0x2e')],_0x27ff31['status'](_0x20f482)['send'](_0x5448f0);};}exports['index']=function(_0x29d4a1,_0x13c6b5){const _0x47064a=_0xca90e2;let _0x8137d7={};const _0x17bf69={},_0x47dfd1={'count':0x0,'rows':[]},_0x33df39=_['map'](db[_0x47064a('0x1d')][_0x47064a('0x5')],function(_0x35d195){const _0x162042=_0x47064a;return{'name':_0x35d195[_0x162042('0x3')],'type':_0x35d195[_0x162042('0x27')][_0x162042('0x11')]};});_0x17bf69[_0x47064a('0x8')]=_['map'](_0x33df39,_0x47064a('0x2e')),_0x17bf69[_0x47064a('0x20')]=_[_0x47064a('0xa')](_0x29d4a1[_0x47064a('0x20')]),_0x17bf69[_0x47064a('0x13')]=_[_0x47064a('0x31')](_0x17bf69[_0x47064a('0x8')],_0x17bf69[_0x47064a('0x20')]),_0x8137d7[_0x47064a('0x2b')]=_[_0x47064a('0x31')](_0x17bf69[_0x47064a('0x8')],qs['fields'](_0x29d4a1['query']['fields'])),_0x8137d7[_0x47064a('0x2b')]=_0x8137d7[_0x47064a('0x2b')][_0x47064a('0x4')]?_0x8137d7[_0x47064a('0x2b')]:_0x17bf69[_0x47064a('0x8')];typeof _0x29d4a1['query'][_0x47064a('0x7')]===_0x47064a('0xd')&&(_0x8137d7['limit']=qs[_0x47064a('0x1e')](_0x29d4a1['query']['limit']),_0x8137d7[_0x47064a('0x6')]=qs[_0x47064a('0x6')](_0x29d4a1[_0x47064a('0x20')][_0x47064a('0x6')]));_0x8137d7[_0x47064a('0x24')]=qs[_0x47064a('0x17')](_0x29d4a1[_0x47064a('0x20')][_0x47064a('0x17')]),_0x8137d7[_0x47064a('0x30')]=qs[_0x47064a('0x13')](_[_0x47064a('0x1f')](_0x29d4a1[_0x47064a('0x20')],_0x17bf69[_0x47064a('0x13')]),_0x33df39);_0x29d4a1[_0x47064a('0x20')][_0x47064a('0x2a')]&&(_0x8137d7[_0x47064a('0x30')]=_[_0x47064a('0x21')](_0x8137d7[_0x47064a('0x30')],{[Op['or']]:_[_0x47064a('0x9')](_0x33df39,function(_0x5f429d){const _0x6e6ac4=_0x47064a;if(_0x5f429d[_0x6e6ac4('0x27')]!==_0x6e6ac4('0x15')){const _0x2bf069={};return _0x2bf069[_0x5f429d[_0x6e6ac4('0x2e')]]={[Op[_0x6e6ac4('0x1c')]]:'%'+_0x29d4a1[_0x6e6ac4('0x20')][_0x6e6ac4('0x2a')]+'%'},_0x2bf069;}})}));_0x8137d7=_['merge']({},_0x8137d7,_0x29d4a1[_0x47064a('0x23')]);const _0x267f60={'where':_0x8137d7[_0x47064a('0x30')]};return db[_0x47064a('0x1d')]['count'](_0x267f60)[_0x47064a('0xf')](function(_0x59d68b){const _0xde71c3=_0x47064a;return _0x47dfd1[_0xde71c3('0x1')]=_0x59d68b,_0x29d4a1['query'][_0xde71c3('0x14')]&&(_0x8137d7[_0xde71c3('0x12')]=[{'all':!![]}]),db[_0xde71c3('0x1d')][_0xde71c3('0x28')](_0x8137d7);})[_0x47064a('0xf')](function(_0x14c941){return _0x47dfd1['rows']=_0x14c941,_0x47dfd1;})[_0x47064a('0xf')](respondWithFilteredResult(_0x13c6b5,_0x8137d7))[_0x47064a('0x2d')](handleError(_0x13c6b5,null));},exports[_0xca90e2('0x19')]=function(_0x96b1a9,_0x7285b4){const _0x31bdf3=_0xca90e2;let _0x464eea={'raw':!![],'where':{'id':_0x96b1a9[_0x31bdf3('0x33')]['id']}};const _0x2d9602={};return _0x2d9602['model']=_[_0x31bdf3('0xa')](db[_0x31bdf3('0x1d')][_0x31bdf3('0x5')]),_0x2d9602[_0x31bdf3('0x20')]=_[_0x31bdf3('0xa')](_0x96b1a9[_0x31bdf3('0x20')]),_0x2d9602[_0x31bdf3('0x13')]=_[_0x31bdf3('0x31')](_0x2d9602[_0x31bdf3('0x8')],_0x2d9602[_0x31bdf3('0x20')]),_0x464eea[_0x31bdf3('0x2b')]=_[_0x31bdf3('0x31')](_0x2d9602[_0x31bdf3('0x8')],qs['fields'](_0x96b1a9[_0x31bdf3('0x20')][_0x31bdf3('0x2c')])),_0x464eea[_0x31bdf3('0x2b')]=_0x464eea[_0x31bdf3('0x2b')][_0x31bdf3('0x4')]?_0x464eea['attributes']:_0x2d9602[_0x31bdf3('0x8')],_0x96b1a9['query'][_0x31bdf3('0x14')]&&(_0x464eea[_0x31bdf3('0x12')]=[{'all':!![]}]),_0x464eea=_[_0x31bdf3('0x21')]({},_0x464eea,_0x96b1a9[_0x31bdf3('0x23')]),db['VoiceQueuesLog']['findOne'](_0x464eea)[_0x31bdf3('0xf')](handleEntityNotFound(_0x7285b4,null))['then'](respondWithResult(_0x7285b4,null))[_0x31bdf3('0x2d')](handleError(_0x7285b4,null));},exports[_0xca90e2('0xb')]=function(_0x19853e,_0x5d30ba){const _0x446c14=_0xca90e2;return db[_0x446c14('0x1d')][_0x446c14('0xb')](_0x19853e['body'],{})[_0x446c14('0xf')](respondWithResult(_0x5d30ba,0xc9))['catch'](handleError(_0x5d30ba,null));},exports[_0xca90e2('0x1b')]=function(_0x2c3058,_0x344b16){const _0x5a7370=_0xca90e2;return _0x2c3058[_0x5a7370('0x29')]['id']&&delete _0x2c3058['body']['id'],db['VoiceQueuesLog'][_0x5a7370('0x18')]({'where':{'id':_0x2c3058[_0x5a7370('0x33')]['id']}})[_0x5a7370('0xf')](handleEntityNotFound(_0x344b16,null))['then'](saveUpdates(_0x2c3058[_0x5a7370('0x29')],null))['then'](respondWithResult(_0x344b16,null))[_0x5a7370('0x2d')](handleError(_0x344b16,null));},exports[_0xca90e2('0xc')]=function(_0x3784ac,_0xd52357){const _0x49272b=_0xca90e2;return db['VoiceQueuesLog'][_0x49272b('0x18')]({'where':{'id':_0x3784ac[_0x49272b('0x33')]['id']}})['then'](handleEntityNotFound(_0xd52357,null))[_0x49272b('0xf')](removeEntity(_0xd52357,null))[_0x49272b('0x2d')](handleError(_0xd52357,null));};