Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / whatsappQueueReport / whatsappQueueReport.controller.js
1 const a815_0x3655=['WhatsappQueueReport','intersection','findOne','type','name','fields','index','update','../../config/logger','body','includeAll','filter','describe','then','filters','length','json','destroy','merge','nolimit','VIRTUAL','where','../../components/parsers/qs','rows','include','show','end','query','like','undefined','lodash','create','options','rawAttributes','sendStatus','map','pick','order','findAll','set','keys','offset','attributes','sort','../../mysqldb','fieldName','limit','count','status','model','catch','Content-Range','sequelize','params'];(function(_0x3a0167,_0x36557e){const _0x46203d=function(_0x1e358c){while(--_0x1e358c){_0x3a0167['push'](_0x3a0167['shift']());}};_0x46203d(++_0x36557e);}(a815_0x3655,0xe9));const a815_0x4620=function(_0x3a0167,_0x36557e){_0x3a0167=_0x3a0167-0x0;let _0x46203d=a815_0x3655[_0x3a0167];return _0x46203d;};const _0x4ba76b=a815_0x4620;'use strict';const _=require(_0x4ba76b('0xd')),qs=require(_0x4ba76b('0x5')),logger=require(_0x4ba76b('0x2d'))('api'),db=require(_0x4ba76b('0x1b'))['db'],{Op}=require(_0x4ba76b('0x23'));function respondWithResult(_0x1e358c,_0x374179){return _0x374179=_0x374179||0xc8,function(_0x5b64c9){const _0x58ef47=a815_0x4620;if(_0x5b64c9)return _0x1e358c[_0x58ef47('0x1f')](_0x374179)[_0x58ef47('0x35')](_0x5b64c9);};}function respondWithFilteredResult(_0x53dd3d,_0x29cf4a){return function(_0x5eb1ee){const _0x5135a2=a815_0x4620;if(_0x5eb1ee){const _0x3e1489=_0x5eb1ee[_0x5135a2('0x1e')],_0x1421d9=_0x29cf4a['offset'];let _0x205e6f=_0x29cf4a['offset']+_0x29cf4a[_0x5135a2('0x1d')],_0x4511bc;return _0x205e6f>=_0x3e1489?(_0x205e6f=_0x3e1489,_0x4511bc=0xc8):_0x4511bc=0xce,_0x53dd3d['status'](_0x4511bc),_0x53dd3d[_0x5135a2('0x16')](_0x5135a2('0x22'),_0x1421d9+'-'+_0x205e6f+'/'+_0x3e1489)[_0x5135a2('0x35')](_0x5eb1ee);}return null;};}function saveUpdates(_0x594032){return function(_0x2b3de8){const _0x151963=a815_0x4620;if(_0x2b3de8)return _0x2b3de8[_0x151963('0x2c')](_0x594032)[_0x151963('0x32')](function(_0x359352){return _0x359352;});return null;};}function removeEntity(_0x346d3c){return function(_0xdda9e4){const _0x2b9c26=a815_0x4620;if(_0xdda9e4)return _0xdda9e4['destroy']()[_0x2b9c26('0x32')](function(){const _0x4396e6=_0x2b9c26;_0x346d3c[_0x4396e6('0x1f')](0xcc)[_0x4396e6('0x9')]();});};}function handleEntityNotFound(_0x2db3b0){return function(_0x437a20){const _0x4d8cb9=a815_0x4620;return!_0x437a20&&_0x2db3b0[_0x4d8cb9('0x11')](0x194),_0x437a20;};}function handleError(_0xaccfe1,_0x4addb2){return _0x4addb2=_0x4addb2||0x1f4,function(_0x5c756a){const _0x219f1a=a815_0x4620;logger['error'](_0x5c756a['stack']),_0x5c756a['name']&&delete _0x5c756a[_0x219f1a('0x29')],_0xaccfe1[_0x219f1a('0x1f')](_0x4addb2)['send'](_0x5c756a);};}exports[_0x4ba76b('0x2b')]=function(_0x3726b5,_0x26b7c4){const _0x3c5f15=_0x4ba76b;let _0x1b3d40={};const _0xb470c6={},_0x110db0={'count':0x0,'rows':[]},_0x21c610=_[_0x3c5f15('0x12')](db[_0x3c5f15('0x25')][_0x3c5f15('0x10')],function(_0x51cfe0){const _0x1e10f6=_0x3c5f15;return{'name':_0x51cfe0[_0x1e10f6('0x1c')],'type':_0x51cfe0[_0x1e10f6('0x28')]['key']};});_0xb470c6[_0x3c5f15('0x20')]=_[_0x3c5f15('0x12')](_0x21c610,_0x3c5f15('0x29')),_0xb470c6[_0x3c5f15('0xa')]=_[_0x3c5f15('0x17')](_0x3726b5[_0x3c5f15('0xa')]),_0xb470c6[_0x3c5f15('0x33')]=_[_0x3c5f15('0x26')](_0xb470c6[_0x3c5f15('0x20')],_0xb470c6[_0x3c5f15('0xa')]),_0x1b3d40[_0x3c5f15('0x19')]=_['intersection'](_0xb470c6[_0x3c5f15('0x20')],qs[_0x3c5f15('0x2a')](_0x3726b5[_0x3c5f15('0xa')][_0x3c5f15('0x2a')])),_0x1b3d40['attributes']=_0x1b3d40[_0x3c5f15('0x19')]['length']?_0x1b3d40[_0x3c5f15('0x19')]:_0xb470c6[_0x3c5f15('0x20')];typeof _0x3726b5[_0x3c5f15('0xa')][_0x3c5f15('0x2')]===_0x3c5f15('0xc')&&(_0x1b3d40[_0x3c5f15('0x1d')]=qs[_0x3c5f15('0x1d')](_0x3726b5['query'][_0x3c5f15('0x1d')]),_0x1b3d40[_0x3c5f15('0x18')]=qs[_0x3c5f15('0x18')](_0x3726b5['query']['offset']));_0x1b3d40[_0x3c5f15('0x14')]=qs[_0x3c5f15('0x1a')](_0x3726b5['query']['sort']),_0x1b3d40[_0x3c5f15('0x4')]=qs[_0x3c5f15('0x33')](_[_0x3c5f15('0x13')](_0x3726b5['query'],_0xb470c6[_0x3c5f15('0x33')]),_0x21c610);_0x3726b5[_0x3c5f15('0xa')][_0x3c5f15('0x30')]&&(_0x1b3d40['where']=_[_0x3c5f15('0x1')](_0x1b3d40[_0x3c5f15('0x4')],{[Op['or']]:_[_0x3c5f15('0x12')](_0x21c610,function(_0x3b0a6a){const _0x2e01c3=_0x3c5f15;if(_0x3b0a6a[_0x2e01c3('0x28')]!==_0x2e01c3('0x3')){const _0x5e228f={};return _0x5e228f[_0x3b0a6a[_0x2e01c3('0x29')]]={[Op[_0x2e01c3('0xb')]]:'%'+_0x3726b5[_0x2e01c3('0xa')][_0x2e01c3('0x30')]+'%'},_0x5e228f;}})}));_0x1b3d40=_['merge']({},_0x1b3d40,_0x3726b5[_0x3c5f15('0xf')]);const _0x3efaeb={'where':_0x1b3d40[_0x3c5f15('0x4')]};return db['WhatsappQueueReport']['count'](_0x3efaeb)[_0x3c5f15('0x32')](function(_0x13a03b){const _0xbb937e=_0x3c5f15;return _0x110db0[_0xbb937e('0x1e')]=_0x13a03b,_0x3726b5[_0xbb937e('0xa')][_0xbb937e('0x2f')]&&(_0x1b3d40[_0xbb937e('0x7')]=[{'all':!![]}]),db[_0xbb937e('0x25')][_0xbb937e('0x15')](_0x1b3d40);})[_0x3c5f15('0x32')](function(_0x219e67){const _0x593eaf=_0x3c5f15;return _0x110db0[_0x593eaf('0x6')]=_0x219e67,_0x110db0;})[_0x3c5f15('0x32')](respondWithFilteredResult(_0x26b7c4,_0x1b3d40))[_0x3c5f15('0x21')](handleError(_0x26b7c4,null));},exports[_0x4ba76b('0x8')]=function(_0x1c9e91,_0x5e3079){const _0x4ed5d1=_0x4ba76b;let _0x176c9e={'raw':!![],'where':{'id':_0x1c9e91[_0x4ed5d1('0x24')]['id']}};const _0x2f99b6={};return _0x2f99b6[_0x4ed5d1('0x20')]=_[_0x4ed5d1('0x17')](db[_0x4ed5d1('0x25')]['rawAttributes']),_0x2f99b6[_0x4ed5d1('0xa')]=_[_0x4ed5d1('0x17')](_0x1c9e91[_0x4ed5d1('0xa')]),_0x2f99b6[_0x4ed5d1('0x33')]=_[_0x4ed5d1('0x26')](_0x2f99b6['model'],_0x2f99b6[_0x4ed5d1('0xa')]),_0x176c9e[_0x4ed5d1('0x19')]=_[_0x4ed5d1('0x26')](_0x2f99b6[_0x4ed5d1('0x20')],qs[_0x4ed5d1('0x2a')](_0x1c9e91['query'][_0x4ed5d1('0x2a')])),_0x176c9e['attributes']=_0x176c9e['attributes'][_0x4ed5d1('0x34')]?_0x176c9e[_0x4ed5d1('0x19')]:_0x2f99b6[_0x4ed5d1('0x20')],_0x1c9e91[_0x4ed5d1('0xa')][_0x4ed5d1('0x2f')]&&(_0x176c9e['include']=[{'all':!![]}]),_0x176c9e=_[_0x4ed5d1('0x1')]({},_0x176c9e,_0x1c9e91['options']),db[_0x4ed5d1('0x25')][_0x4ed5d1('0x27')](_0x176c9e)[_0x4ed5d1('0x32')](handleEntityNotFound(_0x5e3079,null))[_0x4ed5d1('0x32')](respondWithResult(_0x5e3079,null))[_0x4ed5d1('0x21')](handleError(_0x5e3079,null));},exports[_0x4ba76b('0xe')]=function(_0x16876e,_0x591920){const _0x3a80e7=_0x4ba76b;return db['WhatsappQueueReport'][_0x3a80e7('0xe')](_0x16876e[_0x3a80e7('0x2e')],{})['then'](respondWithResult(_0x591920,0xc9))[_0x3a80e7('0x21')](handleError(_0x591920,null));},exports[_0x4ba76b('0x2c')]=function(_0x1d45c2,_0x2f246b){const _0x2b7a70=_0x4ba76b;return _0x1d45c2[_0x2b7a70('0x2e')]['id']&&delete _0x1d45c2[_0x2b7a70('0x2e')]['id'],db['WhatsappQueueReport'][_0x2b7a70('0x27')]({'where':{'id':_0x1d45c2[_0x2b7a70('0x24')]['id']}})[_0x2b7a70('0x32')](handleEntityNotFound(_0x2f246b,null))[_0x2b7a70('0x32')](saveUpdates(_0x1d45c2[_0x2b7a70('0x2e')],null))[_0x2b7a70('0x32')](respondWithResult(_0x2f246b,null))[_0x2b7a70('0x21')](handleError(_0x2f246b,null));},exports[_0x4ba76b('0x0')]=function(_0x271f9a,_0x498231){const _0x48cd25=_0x4ba76b;return db[_0x48cd25('0x25')][_0x48cd25('0x27')]({'where':{'id':_0x271f9a[_0x48cd25('0x24')]['id']}})[_0x48cd25('0x32')](handleEntityNotFound(_0x498231,null))[_0x48cd25('0x32')](removeEntity(_0x498231,null))[_0x48cd25('0x21')](handleError(_0x498231,null));},exports['describe']=function(_0x31de16,_0xc34adb){const _0x55e867=_0x4ba76b;return db['WhatsappQueueReport'][_0x55e867('0x31')]()[_0x55e867('0x32')](respondWithResult(_0xc34adb,null))['catch'](handleError(_0xc34adb,null));};