Built motion from commit ecdc8e66766c75b1b08288b0ea13eb12d42606b4. Version 3.0.0...
[motion-next.git] / server / api / faxQueueReport / faxQueueReport.controller.js
1 const a219_0x26b4=['fields','like','offset','limit','sequelize','../../components/parsers/qs','rows','params','api','json','destroy','status','rawAttributes','body','filter','includeAll','Content-Range','FaxQueueReport','describe','intersection','where','count','index','set','query','then','type','merge','send','update','create','findOne','sort','show','model','lodash','error','order','length','keys','map','undefined','findAll','../../config/logger','sendStatus','pick','catch','fieldName','name','include','attributes','../../mysqldb','filters'];(function(_0x48e0b5,_0x26b429){const _0x272711=function(_0x4ce2a6){while(--_0x4ce2a6){_0x48e0b5['push'](_0x48e0b5['shift']());}};_0x272711(++_0x26b429);}(a219_0x26b4,0xcd));const a219_0x2727=function(_0x48e0b5,_0x26b429){_0x48e0b5=_0x48e0b5-0x0;let _0x272711=a219_0x26b4[_0x48e0b5];return _0x272711;};const _0x1e3b01=a219_0x2727;'use strict';const _=require(_0x1e3b01('0x2a')),qs=require(_0x1e3b01('0xc')),logger=require(_0x1e3b01('0x32'))(_0x1e3b01('0xf')),db=require(_0x1e3b01('0x5'))['db'],{Op}=require(_0x1e3b01('0xb'));function respondWithResult(_0x4ce2a6,_0x2634ea){return _0x2634ea=_0x2634ea||0xc8,function(_0x4c63d8){const _0x15d11f=a219_0x2727;if(_0x4c63d8)return _0x4ce2a6['status'](_0x2634ea)[_0x15d11f('0x10')](_0x4c63d8);};}function respondWithFilteredResult(_0x29a64d,_0x1281d9){return function(_0x47efc0){const _0x39edd2=a219_0x2727;if(_0x47efc0){const _0x443d04=_0x47efc0[_0x39edd2('0x1c')],_0x48acd7=_0x1281d9[_0x39edd2('0x9')];let _0x1bca6a=_0x1281d9[_0x39edd2('0x9')]+_0x1281d9[_0x39edd2('0xa')],_0x49a1b2;return _0x1bca6a>=_0x443d04?(_0x1bca6a=_0x443d04,_0x49a1b2=0xc8):_0x49a1b2=0xce,_0x29a64d[_0x39edd2('0x12')](_0x49a1b2),_0x29a64d[_0x39edd2('0x1e')](_0x39edd2('0x17'),_0x48acd7+'-'+_0x1bca6a+'/'+_0x443d04)[_0x39edd2('0x10')](_0x47efc0);}return null;};}function saveUpdates(_0x18639e){return function(_0x54cf56){const _0x54c7bd=a219_0x2727;if(_0x54cf56)return _0x54cf56[_0x54c7bd('0x24')](_0x18639e)[_0x54c7bd('0x20')](function(_0x2a0b2d){return _0x2a0b2d;});return null;};}function removeEntity(_0xbf3573){return function(_0x7ca78a){const _0x40d4cf=a219_0x2727;if(_0x7ca78a)return _0x7ca78a[_0x40d4cf('0x11')]()['then'](function(){const _0x24a6ad=_0x40d4cf;_0xbf3573[_0x24a6ad('0x12')](0xcc)['end']();});};}function handleEntityNotFound(_0x4ad9c0){return function(_0x2b3fb2){const _0x5201b1=a219_0x2727;return!_0x2b3fb2&&_0x4ad9c0[_0x5201b1('0x33')](0x194),_0x2b3fb2;};}function handleError(_0x5acdc3,_0x2d2ed9){return _0x2d2ed9=_0x2d2ed9||0x1f4,function(_0x27ee16){const _0x3e3c32=a219_0x2727;logger[_0x3e3c32('0x2b')](_0x27ee16['stack']),_0x27ee16[_0x3e3c32('0x2')]&&delete _0x27ee16[_0x3e3c32('0x2')],_0x5acdc3[_0x3e3c32('0x12')](_0x2d2ed9)[_0x3e3c32('0x23')](_0x27ee16);};}exports[_0x1e3b01('0x1d')]=function(_0x2ae619,_0x274fd3){const _0x45b5c4=_0x1e3b01;let _0x2a58fc={};const _0x2014c7={},_0x1a43be={'count':0x0,'rows':[]},_0xf72628=_['map'](db[_0x45b5c4('0x18')]['rawAttributes'],function(_0x397d7f){const _0x457bfd=_0x45b5c4;return{'name':_0x397d7f[_0x457bfd('0x1')],'type':_0x397d7f[_0x457bfd('0x21')]['key']};});_0x2014c7[_0x45b5c4('0x29')]=_[_0x45b5c4('0x2f')](_0xf72628,_0x45b5c4('0x2')),_0x2014c7['query']=_[_0x45b5c4('0x2e')](_0x2ae619[_0x45b5c4('0x1f')]),_0x2014c7[_0x45b5c4('0x6')]=_[_0x45b5c4('0x1a')](_0x2014c7[_0x45b5c4('0x29')],_0x2014c7[_0x45b5c4('0x1f')]),_0x2a58fc[_0x45b5c4('0x4')]=_[_0x45b5c4('0x1a')](_0x2014c7[_0x45b5c4('0x29')],qs[_0x45b5c4('0x7')](_0x2ae619[_0x45b5c4('0x1f')][_0x45b5c4('0x7')])),_0x2a58fc['attributes']=_0x2a58fc[_0x45b5c4('0x4')][_0x45b5c4('0x2d')]?_0x2a58fc[_0x45b5c4('0x4')]:_0x2014c7[_0x45b5c4('0x29')];typeof _0x2ae619['query']['nolimit']===_0x45b5c4('0x30')&&(_0x2a58fc['limit']=qs['limit'](_0x2ae619['query'][_0x45b5c4('0xa')]),_0x2a58fc[_0x45b5c4('0x9')]=qs['offset'](_0x2ae619[_0x45b5c4('0x1f')]['offset']));_0x2a58fc[_0x45b5c4('0x2c')]=qs[_0x45b5c4('0x27')](_0x2ae619[_0x45b5c4('0x1f')][_0x45b5c4('0x27')]),_0x2a58fc['where']=qs[_0x45b5c4('0x6')](_[_0x45b5c4('0x34')](_0x2ae619['query'],_0x2014c7[_0x45b5c4('0x6')]),_0xf72628);_0x2ae619[_0x45b5c4('0x1f')][_0x45b5c4('0x15')]&&(_0x2a58fc[_0x45b5c4('0x1b')]=_['merge'](_0x2a58fc[_0x45b5c4('0x1b')],{[Op['or']]:_[_0x45b5c4('0x2f')](_0xf72628,function(_0x1e0aee){const _0x487240=_0x45b5c4;if(_0x1e0aee['type']!=='VIRTUAL'){const _0x3d84f2={};return _0x3d84f2[_0x1e0aee[_0x487240('0x2')]]={[Op[_0x487240('0x8')]]:'%'+_0x2ae619[_0x487240('0x1f')][_0x487240('0x15')]+'%'},_0x3d84f2;}})}));_0x2a58fc=_[_0x45b5c4('0x22')]({},_0x2a58fc,_0x2ae619['options']);const _0x246587={'where':_0x2a58fc[_0x45b5c4('0x1b')]};return db[_0x45b5c4('0x18')][_0x45b5c4('0x1c')](_0x246587)['then'](function(_0x1df992){const _0x3df72c=_0x45b5c4;return _0x1a43be[_0x3df72c('0x1c')]=_0x1df992,_0x2ae619[_0x3df72c('0x1f')][_0x3df72c('0x16')]&&(_0x2a58fc[_0x3df72c('0x3')]=[{'all':!![]}]),db['FaxQueueReport'][_0x3df72c('0x31')](_0x2a58fc);})[_0x45b5c4('0x20')](function(_0x4a4bb4){const _0x2c1976=_0x45b5c4;return _0x1a43be[_0x2c1976('0xd')]=_0x4a4bb4,_0x1a43be;})['then'](respondWithFilteredResult(_0x274fd3,_0x2a58fc))[_0x45b5c4('0x0')](handleError(_0x274fd3,null));},exports[_0x1e3b01('0x28')]=function(_0xb692bb,_0x28220e){const _0x4bef55=_0x1e3b01;let _0x3a8f00={'raw':!![],'where':{'id':_0xb692bb['params']['id']}};const _0x52d77e={};return _0x52d77e[_0x4bef55('0x29')]=_[_0x4bef55('0x2e')](db[_0x4bef55('0x18')][_0x4bef55('0x13')]),_0x52d77e[_0x4bef55('0x1f')]=_[_0x4bef55('0x2e')](_0xb692bb[_0x4bef55('0x1f')]),_0x52d77e[_0x4bef55('0x6')]=_['intersection'](_0x52d77e['model'],_0x52d77e[_0x4bef55('0x1f')]),_0x3a8f00[_0x4bef55('0x4')]=_[_0x4bef55('0x1a')](_0x52d77e['model'],qs[_0x4bef55('0x7')](_0xb692bb[_0x4bef55('0x1f')]['fields'])),_0x3a8f00[_0x4bef55('0x4')]=_0x3a8f00[_0x4bef55('0x4')][_0x4bef55('0x2d')]?_0x3a8f00[_0x4bef55('0x4')]:_0x52d77e[_0x4bef55('0x29')],_0xb692bb['query'][_0x4bef55('0x16')]&&(_0x3a8f00['include']=[{'all':!![]}]),_0x3a8f00=_[_0x4bef55('0x22')]({},_0x3a8f00,_0xb692bb['options']),db[_0x4bef55('0x18')]['findOne'](_0x3a8f00)['then'](handleEntityNotFound(_0x28220e,null))[_0x4bef55('0x20')](respondWithResult(_0x28220e,null))['catch'](handleError(_0x28220e,null));},exports[_0x1e3b01('0x25')]=function(_0x41786c,_0x103c19){const _0x5962c6=_0x1e3b01;return db[_0x5962c6('0x18')][_0x5962c6('0x25')](_0x41786c[_0x5962c6('0x14')],{})['then'](respondWithResult(_0x103c19,0xc9))[_0x5962c6('0x0')](handleError(_0x103c19,null));},exports[_0x1e3b01('0x24')]=function(_0x4e8ca7,_0x5c1494){const _0x1830b9=_0x1e3b01;return _0x4e8ca7[_0x1830b9('0x14')]['id']&&delete _0x4e8ca7[_0x1830b9('0x14')]['id'],db[_0x1830b9('0x18')][_0x1830b9('0x26')]({'where':{'id':_0x4e8ca7[_0x1830b9('0xe')]['id']}})[_0x1830b9('0x20')](handleEntityNotFound(_0x5c1494,null))[_0x1830b9('0x20')](saveUpdates(_0x4e8ca7['body'],null))['then'](respondWithResult(_0x5c1494,null))[_0x1830b9('0x0')](handleError(_0x5c1494,null));},exports['destroy']=function(_0x37d299,_0x285fdb){const _0x1c3da6=_0x1e3b01;return db[_0x1c3da6('0x18')]['findOne']({'where':{'id':_0x37d299['params']['id']}})[_0x1c3da6('0x20')](handleEntityNotFound(_0x285fdb,null))[_0x1c3da6('0x20')](removeEntity(_0x285fdb,null))[_0x1c3da6('0x0')](handleError(_0x285fdb,null));},exports[_0x1e3b01('0x19')]=function(_0x46d86e,_0x39399e){const _0x2a621d=_0x1e3b01;return db[_0x2a621d('0x18')][_0x2a621d('0x19')]()[_0x2a621d('0x20')](respondWithResult(_0x39399e,null))['catch'](handleError(_0x39399e,null));};