Built motion from commit 8dca541896b0ff92bb88a36cc13f4f385b593b4b. Version 3.0.0...
[motion-next.git] / server / api / whatsappQueueReport / whatsappQueueReport.controller.js
index 9bd7191..e4c0f5a 100644 (file)
@@ -1 +1 @@
-const a815_0x327b=['../../config/logger','rawAttributes','catch','order','sequelize','body','limit','count','create','merge','filter','error','VIRTUAL','map','index','keys','options','then','like','attributes','intersection','params','nolimit','Content-Range','findOne','status','undefined','query','fields','WhatsappQueueReport','set','length','name','destroy','sort','../../mysqldb','describe','where','update','key','model','show','fieldName','include','findAll','includeAll','offset','filters','json','end'];(function(_0x187721,_0x327b52){const _0x1614ac=function(_0x105416){while(--_0x105416){_0x187721['push'](_0x187721['shift']());}};_0x1614ac(++_0x327b52);}(a815_0x327b,0xa9));const a815_0x1614=function(_0x187721,_0x327b52){_0x187721=_0x187721-0x0;let _0x1614ac=a815_0x327b[_0x187721];return _0x1614ac;};const _0x369426=a815_0x1614;'use strict';const _=require('lodash'),qs=require('../../components/parsers/qs'),logger=require(_0x369426('0x1f'))('api'),db=require(_0x369426('0x10'))['db'],{Op}=require(_0x369426('0x23'));function respondWithResult(_0x105416,_0x1c79cb){return _0x1c79cb=_0x1c79cb||0xc8,function(_0x21fcdb){if(_0x21fcdb)return _0x105416['status'](_0x1c79cb)['json'](_0x21fcdb);};}function respondWithFilteredResult(_0x34c7ec,_0xa3dfb4){return function(_0x4fca65){const _0x34699a=a815_0x1614;if(_0x4fca65){const _0x330093=_0x4fca65['count'],_0x3bed73=_0xa3dfb4[_0x34699a('0x1b')];let _0x107e7e=_0xa3dfb4[_0x34699a('0x1b')]+_0xa3dfb4[_0x34699a('0x25')],_0x11ce80;return _0x107e7e>=_0x330093?(_0x107e7e=_0x330093,_0x11ce80=0xc8):_0x11ce80=0xce,_0x34c7ec[_0x34699a('0x6')](_0x11ce80),_0x34c7ec[_0x34699a('0xb')](_0x34699a('0x4'),_0x3bed73+'-'+_0x107e7e+'/'+_0x330093)[_0x34699a('0x1d')](_0x4fca65);}return null;};}function saveUpdates(_0x2878bb){return function(_0x5e8590){const _0x1cfe54=a815_0x1614;if(_0x5e8590)return _0x5e8590[_0x1cfe54('0x13')](_0x2878bb)[_0x1cfe54('0x30')](function(_0x4709e1){return _0x4709e1;});return null;};}function removeEntity(_0x161cdd){return function(_0xfe5555){const _0x1251ab=a815_0x1614;if(_0xfe5555)return _0xfe5555[_0x1251ab('0xe')]()[_0x1251ab('0x30')](function(){const _0x2d208a=_0x1251ab;_0x161cdd[_0x2d208a('0x6')](0xcc)[_0x2d208a('0x1e')]();});};}function handleEntityNotFound(_0x570bd6){return function(_0x698cf1){return!_0x698cf1&&_0x570bd6['sendStatus'](0x194),_0x698cf1;};}function handleError(_0x2e05d1,_0x2086dd){return _0x2086dd=_0x2086dd||0x1f4,function(_0x466189){const _0x8bf969=a815_0x1614;logger[_0x8bf969('0x2a')](_0x466189['stack']),_0x466189[_0x8bf969('0xd')]&&delete _0x466189[_0x8bf969('0xd')],_0x2e05d1[_0x8bf969('0x6')](_0x2086dd)['send'](_0x466189);};}exports[_0x369426('0x2d')]=function(_0x7a0b7a,_0x286fbf){const _0x44f0a8=_0x369426;let _0x4f5b14={};const _0x1f9086={},_0x290877={'count':0x0,'rows':[]},_0x35457a=_[_0x44f0a8('0x2c')](db[_0x44f0a8('0xa')][_0x44f0a8('0x20')],function(_0x456a2f){const _0x14c00a=_0x44f0a8;return{'name':_0x456a2f[_0x14c00a('0x17')],'type':_0x456a2f['type'][_0x14c00a('0x14')]};});_0x1f9086[_0x44f0a8('0x15')]=_[_0x44f0a8('0x2c')](_0x35457a,_0x44f0a8('0xd')),_0x1f9086['query']=_[_0x44f0a8('0x2e')](_0x7a0b7a[_0x44f0a8('0x8')]),_0x1f9086['filters']=_['intersection'](_0x1f9086[_0x44f0a8('0x15')],_0x1f9086[_0x44f0a8('0x8')]),_0x4f5b14[_0x44f0a8('0x0')]=_[_0x44f0a8('0x1')](_0x1f9086[_0x44f0a8('0x15')],qs[_0x44f0a8('0x9')](_0x7a0b7a['query']['fields'])),_0x4f5b14[_0x44f0a8('0x0')]=_0x4f5b14[_0x44f0a8('0x0')]['length']?_0x4f5b14['attributes']:_0x1f9086['model'];typeof _0x7a0b7a[_0x44f0a8('0x8')][_0x44f0a8('0x3')]===_0x44f0a8('0x7')&&(_0x4f5b14[_0x44f0a8('0x25')]=qs[_0x44f0a8('0x25')](_0x7a0b7a[_0x44f0a8('0x8')][_0x44f0a8('0x25')]),_0x4f5b14[_0x44f0a8('0x1b')]=qs[_0x44f0a8('0x1b')](_0x7a0b7a['query'][_0x44f0a8('0x1b')]));_0x4f5b14[_0x44f0a8('0x22')]=qs[_0x44f0a8('0xf')](_0x7a0b7a[_0x44f0a8('0x8')][_0x44f0a8('0xf')]),_0x4f5b14[_0x44f0a8('0x12')]=qs['filters'](_['pick'](_0x7a0b7a[_0x44f0a8('0x8')],_0x1f9086[_0x44f0a8('0x1c')]),_0x35457a);_0x7a0b7a['query'][_0x44f0a8('0x29')]&&(_0x4f5b14[_0x44f0a8('0x12')]=_[_0x44f0a8('0x28')](_0x4f5b14[_0x44f0a8('0x12')],{[Op['or']]:_[_0x44f0a8('0x2c')](_0x35457a,function(_0x2de827){const _0x1b8d4d=_0x44f0a8;if(_0x2de827['type']!==_0x1b8d4d('0x2b')){const _0x15f333={};return _0x15f333[_0x2de827[_0x1b8d4d('0xd')]]={[Op[_0x1b8d4d('0x31')]]:'%'+_0x7a0b7a[_0x1b8d4d('0x8')]['filter']+'%'},_0x15f333;}})}));_0x4f5b14=_[_0x44f0a8('0x28')]({},_0x4f5b14,_0x7a0b7a[_0x44f0a8('0x2f')]);const _0x5070af={'where':_0x4f5b14[_0x44f0a8('0x12')]};return db['WhatsappQueueReport'][_0x44f0a8('0x26')](_0x5070af)[_0x44f0a8('0x30')](function(_0x43ca97){const _0x59b0f7=_0x44f0a8;return _0x290877['count']=_0x43ca97,_0x7a0b7a[_0x59b0f7('0x8')][_0x59b0f7('0x1a')]&&(_0x4f5b14[_0x59b0f7('0x18')]=[{'all':!![]}]),db['WhatsappQueueReport'][_0x59b0f7('0x19')](_0x4f5b14);})[_0x44f0a8('0x30')](function(_0x1438f5){return _0x290877['rows']=_0x1438f5,_0x290877;})[_0x44f0a8('0x30')](respondWithFilteredResult(_0x286fbf,_0x4f5b14))[_0x44f0a8('0x21')](handleError(_0x286fbf,null));},exports[_0x369426('0x16')]=function(_0x4c625e,_0x265ea9){const _0x1472ac=_0x369426;let _0x30d547={'raw':!![],'where':{'id':_0x4c625e[_0x1472ac('0x2')]['id']}};const _0x5667bf={};return _0x5667bf['model']=_['keys'](db['WhatsappQueueReport']['rawAttributes']),_0x5667bf[_0x1472ac('0x8')]=_[_0x1472ac('0x2e')](_0x4c625e[_0x1472ac('0x8')]),_0x5667bf[_0x1472ac('0x1c')]=_[_0x1472ac('0x1')](_0x5667bf['model'],_0x5667bf[_0x1472ac('0x8')]),_0x30d547['attributes']=_[_0x1472ac('0x1')](_0x5667bf[_0x1472ac('0x15')],qs[_0x1472ac('0x9')](_0x4c625e[_0x1472ac('0x8')][_0x1472ac('0x9')])),_0x30d547[_0x1472ac('0x0')]=_0x30d547[_0x1472ac('0x0')][_0x1472ac('0xc')]?_0x30d547[_0x1472ac('0x0')]:_0x5667bf[_0x1472ac('0x15')],_0x4c625e['query']['includeAll']&&(_0x30d547['include']=[{'all':!![]}]),_0x30d547=_[_0x1472ac('0x28')]({},_0x30d547,_0x4c625e[_0x1472ac('0x2f')]),db['WhatsappQueueReport'][_0x1472ac('0x5')](_0x30d547)[_0x1472ac('0x30')](handleEntityNotFound(_0x265ea9,null))[_0x1472ac('0x30')](respondWithResult(_0x265ea9,null))['catch'](handleError(_0x265ea9,null));},exports[_0x369426('0x27')]=function(_0x49e9eb,_0x27e772){const _0x2c3c1f=_0x369426;return db['WhatsappQueueReport'][_0x2c3c1f('0x27')](_0x49e9eb[_0x2c3c1f('0x24')],{})[_0x2c3c1f('0x30')](respondWithResult(_0x27e772,0xc9))['catch'](handleError(_0x27e772,null));},exports['update']=function(_0x19e7c5,_0x50e847){const _0x1be2e3=_0x369426;return _0x19e7c5[_0x1be2e3('0x24')]['id']&&delete _0x19e7c5['body']['id'],db[_0x1be2e3('0xa')][_0x1be2e3('0x5')]({'where':{'id':_0x19e7c5[_0x1be2e3('0x2')]['id']}})[_0x1be2e3('0x30')](handleEntityNotFound(_0x50e847,null))[_0x1be2e3('0x30')](saveUpdates(_0x19e7c5['body'],null))[_0x1be2e3('0x30')](respondWithResult(_0x50e847,null))['catch'](handleError(_0x50e847,null));},exports['destroy']=function(_0x356305,_0x307358){const _0x165192=_0x369426;return db[_0x165192('0xa')][_0x165192('0x5')]({'where':{'id':_0x356305[_0x165192('0x2')]['id']}})['then'](handleEntityNotFound(_0x307358,null))[_0x165192('0x30')](removeEntity(_0x307358,null))[_0x165192('0x21')](handleError(_0x307358,null));},exports[_0x369426('0x11')]=function(_0x3b0ebd,_0x3f782e){const _0x1ea741=_0x369426;return db[_0x1ea741('0xa')][_0x1ea741('0x11')]()[_0x1ea741('0x30')](respondWithResult(_0x3f782e,null))[_0x1ea741('0x21')](handleError(_0x3f782e,null));};
\ No newline at end of file
+const a815_0x5aee=['lodash','send','WhatsappQueueReport','model','type','findOne','stack','json','fields','limit','length','key','query','keys','filters','../../config/logger','undefined','fieldName','map','catch','attributes','findAll','offset','create','end','intersection','count','api','like','params','filter','rows','merge','update','sequelize','name','Content-Range','show','describe','set','options','nolimit','where','body','status','then','rawAttributes','../../mysqldb','destroy','includeAll'];(function(_0xa38a4d,_0x5aee52){const _0x31126c=function(_0x47a3dd){while(--_0x47a3dd){_0xa38a4d['push'](_0xa38a4d['shift']());}};_0x31126c(++_0x5aee52);}(a815_0x5aee,0x1b9));const a815_0x3112=function(_0xa38a4d,_0x5aee52){_0xa38a4d=_0xa38a4d-0x0;let _0x31126c=a815_0x5aee[_0xa38a4d];return _0x31126c;};const _0x23f838=a815_0x3112;'use strict';const _=require(_0x23f838('0x9')),qs=require('../../components/parsers/qs'),logger=require(_0x23f838('0x18'))(_0x23f838('0x24')),db=require(_0x23f838('0x6'))['db'],{Op}=require(_0x23f838('0x2b'));function respondWithResult(_0x47a3dd,_0x9ef69a){return _0x9ef69a=_0x9ef69a||0xc8,function(_0x514c74){const _0x513b8b=a815_0x3112;if(_0x514c74)return _0x47a3dd[_0x513b8b('0x3')](_0x9ef69a)[_0x513b8b('0x10')](_0x514c74);};}function respondWithFilteredResult(_0xe67eea,_0x3a5c26){return function(_0x1472e7){const _0x162d45=a815_0x3112;if(_0x1472e7){const _0x16b27e=_0x1472e7[_0x162d45('0x23')],_0x387c3a=_0x3a5c26[_0x162d45('0x1f')];let _0x43fd0c=_0x3a5c26[_0x162d45('0x1f')]+_0x3a5c26[_0x162d45('0x12')],_0x32e6f7;return _0x43fd0c>=_0x16b27e?(_0x43fd0c=_0x16b27e,_0x32e6f7=0xc8):_0x32e6f7=0xce,_0xe67eea[_0x162d45('0x3')](_0x32e6f7),_0xe67eea[_0x162d45('0x30')](_0x162d45('0x2d'),_0x387c3a+'-'+_0x43fd0c+'/'+_0x16b27e)[_0x162d45('0x10')](_0x1472e7);}return null;};}function saveUpdates(_0x4cff6f){return function(_0x1f2018){const _0x358e2f=a815_0x3112;if(_0x1f2018)return _0x1f2018[_0x358e2f('0x2a')](_0x4cff6f)['then'](function(_0x46b398){return _0x46b398;});return null;};}function removeEntity(_0x11f753){return function(_0x13ae43){const _0x34e496=a815_0x3112;if(_0x13ae43)return _0x13ae43['destroy']()[_0x34e496('0x4')](function(){const _0x2a2796=_0x34e496;_0x11f753[_0x2a2796('0x3')](0xcc)[_0x2a2796('0x21')]();});};}function handleEntityNotFound(_0x523a56){return function(_0xbe8b69){return!_0xbe8b69&&_0x523a56['sendStatus'](0x194),_0xbe8b69;};}function handleError(_0xa7ebea,_0x32a92b){return _0x32a92b=_0x32a92b||0x1f4,function(_0x52500e){const _0x21e0f0=a815_0x3112;logger['error'](_0x52500e[_0x21e0f0('0xf')]),_0x52500e[_0x21e0f0('0x2c')]&&delete _0x52500e['name'],_0xa7ebea['status'](_0x32a92b)[_0x21e0f0('0xa')](_0x52500e);};}exports['index']=function(_0x43bb7d,_0x51b59d){const _0x503725=_0x23f838;let _0x191462={};const _0x2b56a8={},_0x2455e7={'count':0x0,'rows':[]},_0x349e2c=_[_0x503725('0x1b')](db[_0x503725('0xb')][_0x503725('0x5')],function(_0x25b037){const _0x1fc0b0=_0x503725;return{'name':_0x25b037[_0x1fc0b0('0x1a')],'type':_0x25b037[_0x1fc0b0('0xd')][_0x1fc0b0('0x14')]};});_0x2b56a8['model']=_[_0x503725('0x1b')](_0x349e2c,'name'),_0x2b56a8[_0x503725('0x15')]=_[_0x503725('0x16')](_0x43bb7d[_0x503725('0x15')]),_0x2b56a8[_0x503725('0x17')]=_[_0x503725('0x22')](_0x2b56a8[_0x503725('0xc')],_0x2b56a8[_0x503725('0x15')]),_0x191462[_0x503725('0x1d')]=_[_0x503725('0x22')](_0x2b56a8['model'],qs['fields'](_0x43bb7d[_0x503725('0x15')]['fields'])),_0x191462[_0x503725('0x1d')]=_0x191462['attributes'][_0x503725('0x13')]?_0x191462[_0x503725('0x1d')]:_0x2b56a8[_0x503725('0xc')];typeof _0x43bb7d[_0x503725('0x15')][_0x503725('0x0')]===_0x503725('0x19')&&(_0x191462[_0x503725('0x12')]=qs[_0x503725('0x12')](_0x43bb7d[_0x503725('0x15')][_0x503725('0x12')]),_0x191462[_0x503725('0x1f')]=qs[_0x503725('0x1f')](_0x43bb7d[_0x503725('0x15')][_0x503725('0x1f')]));_0x191462['order']=qs['sort'](_0x43bb7d[_0x503725('0x15')]['sort']),_0x191462[_0x503725('0x1')]=qs[_0x503725('0x17')](_['pick'](_0x43bb7d[_0x503725('0x15')],_0x2b56a8[_0x503725('0x17')]),_0x349e2c);_0x43bb7d['query'][_0x503725('0x27')]&&(_0x191462[_0x503725('0x1')]=_[_0x503725('0x29')](_0x191462[_0x503725('0x1')],{[Op['or']]:_[_0x503725('0x1b')](_0x349e2c,function(_0x1cc466){const _0xc30000=_0x503725;if(_0x1cc466['type']!=='VIRTUAL'){const _0x19ce4d={};return _0x19ce4d[_0x1cc466['name']]={[Op[_0xc30000('0x25')]]:'%'+_0x43bb7d['query'][_0xc30000('0x27')]+'%'},_0x19ce4d;}})}));_0x191462=_[_0x503725('0x29')]({},_0x191462,_0x43bb7d[_0x503725('0x31')]);const _0x517c07={'where':_0x191462[_0x503725('0x1')]};return db[_0x503725('0xb')]['count'](_0x517c07)[_0x503725('0x4')](function(_0x1aaf5f){const _0x47b6ed=_0x503725;return _0x2455e7['count']=_0x1aaf5f,_0x43bb7d[_0x47b6ed('0x15')][_0x47b6ed('0x8')]&&(_0x191462['include']=[{'all':!![]}]),db[_0x47b6ed('0xb')][_0x47b6ed('0x1e')](_0x191462);})[_0x503725('0x4')](function(_0x15d486){const _0x59a63e=_0x503725;return _0x2455e7[_0x59a63e('0x28')]=_0x15d486,_0x2455e7;})[_0x503725('0x4')](respondWithFilteredResult(_0x51b59d,_0x191462))[_0x503725('0x1c')](handleError(_0x51b59d,null));},exports[_0x23f838('0x2e')]=function(_0x266085,_0x143a88){const _0x275553=_0x23f838;let _0x222485={'raw':!![],'where':{'id':_0x266085['params']['id']}};const _0x37f6b9={};return _0x37f6b9['model']=_['keys'](db[_0x275553('0xb')]['rawAttributes']),_0x37f6b9['query']=_[_0x275553('0x16')](_0x266085[_0x275553('0x15')]),_0x37f6b9[_0x275553('0x17')]=_[_0x275553('0x22')](_0x37f6b9[_0x275553('0xc')],_0x37f6b9[_0x275553('0x15')]),_0x222485[_0x275553('0x1d')]=_['intersection'](_0x37f6b9[_0x275553('0xc')],qs[_0x275553('0x11')](_0x266085[_0x275553('0x15')][_0x275553('0x11')])),_0x222485[_0x275553('0x1d')]=_0x222485['attributes'][_0x275553('0x13')]?_0x222485[_0x275553('0x1d')]:_0x37f6b9[_0x275553('0xc')],_0x266085['query'][_0x275553('0x8')]&&(_0x222485['include']=[{'all':!![]}]),_0x222485=_[_0x275553('0x29')]({},_0x222485,_0x266085[_0x275553('0x31')]),db['WhatsappQueueReport']['findOne'](_0x222485)['then'](handleEntityNotFound(_0x143a88,null))['then'](respondWithResult(_0x143a88,null))[_0x275553('0x1c')](handleError(_0x143a88,null));},exports[_0x23f838('0x20')]=function(_0x3fa87b,_0x224dac){const _0x1c775d=_0x23f838;return db['WhatsappQueueReport'][_0x1c775d('0x20')](_0x3fa87b[_0x1c775d('0x2')],{})[_0x1c775d('0x4')](respondWithResult(_0x224dac,0xc9))[_0x1c775d('0x1c')](handleError(_0x224dac,null));},exports[_0x23f838('0x2a')]=function(_0x84e4d6,_0x11241b){const _0x59b104=_0x23f838;return _0x84e4d6[_0x59b104('0x2')]['id']&&delete _0x84e4d6[_0x59b104('0x2')]['id'],db['WhatsappQueueReport']['findOne']({'where':{'id':_0x84e4d6['params']['id']}})['then'](handleEntityNotFound(_0x11241b,null))['then'](saveUpdates(_0x84e4d6[_0x59b104('0x2')],null))[_0x59b104('0x4')](respondWithResult(_0x11241b,null))[_0x59b104('0x1c')](handleError(_0x11241b,null));},exports[_0x23f838('0x7')]=function(_0x531cf1,_0x28642c){const _0x2f2ede=_0x23f838;return db[_0x2f2ede('0xb')][_0x2f2ede('0xe')]({'where':{'id':_0x531cf1[_0x2f2ede('0x26')]['id']}})[_0x2f2ede('0x4')](handleEntityNotFound(_0x28642c,null))[_0x2f2ede('0x4')](removeEntity(_0x28642c,null))[_0x2f2ede('0x1c')](handleError(_0x28642c,null));},exports[_0x23f838('0x2f')]=function(_0x1fb926,_0x2fa8a0){const _0x2aa818=_0x23f838;return db[_0x2aa818('0xb')][_0x2aa818('0x2f')]()[_0x2aa818('0x4')](respondWithResult(_0x2fa8a0,null))[_0x2aa818('0x1c')](handleError(_0x2fa8a0,null));};
\ No newline at end of file