Built motion from commit b51cdcb3f2cb46634587ce1d55ea1b8f32dacea6. Version 3.0.0...
[motion-next.git] / server / api / whatsappQueueReport / whatsappQueueReport.controller.js
index 0895960..389947e 100644 (file)
@@ -1 +1 @@
-const a815_0xeb38=['sendStatus','order','describe','filters','send','includeAll','offset','merge','VIRTUAL','fieldName','length','../../mysqldb','attributes','rows','WhatsappQueueReport','keys','fields','sort','query','findOne','end','options','catch','params','../../config/logger','body','error','nolimit','../../components/parsers/qs','count','type','intersection','show','index','update','findAll','pick','key','rawAttributes','status','then','map','model','stack','destroy','where','limit','create','filter','include','json','undefined','name'];(function(_0x234431,_0xeb381b){const _0x1877c1=function(_0x3f4ca3){while(--_0x3f4ca3){_0x234431['push'](_0x234431['shift']());}};_0x1877c1(++_0xeb381b);}(a815_0xeb38,0x1b7));const a815_0x1877=function(_0x234431,_0xeb381b){_0x234431=_0x234431-0x0;let _0x1877c1=a815_0xeb38[_0x234431];return _0x1877c1;};const _0x26fb93=a815_0x1877;'use strict';const _=require('lodash'),qs=require(_0x26fb93('0xd')),logger=require(_0x26fb93('0x9'))('api'),db=require(_0x26fb93('0x31'))['db'],{Op}=require('sequelize');function respondWithResult(_0x3f4ca3,_0x5aea4a){return _0x5aea4a=_0x5aea4a||0xc8,function(_0x5ec953){const _0x5fa574=a815_0x1877;if(_0x5ec953)return _0x3f4ca3[_0x5fa574('0x18')](_0x5aea4a)[_0x5fa574('0x23')](_0x5ec953);};}function respondWithFilteredResult(_0x178da8,_0x43bd36){return function(_0x102ca6){const _0x43af96=a815_0x1877;if(_0x102ca6){const _0x1feda4=_0x102ca6[_0x43af96('0xe')],_0x451147=_0x43bd36[_0x43af96('0x2c')];let _0x4c8b72=_0x43bd36[_0x43af96('0x2c')]+_0x43bd36['limit'],_0x28d1d2;return _0x4c8b72>=_0x1feda4?(_0x4c8b72=_0x1feda4,_0x28d1d2=0xc8):_0x28d1d2=0xce,_0x178da8[_0x43af96('0x18')](_0x28d1d2),_0x178da8['set']('Content-Range',_0x451147+'-'+_0x4c8b72+'/'+_0x1feda4)[_0x43af96('0x23')](_0x102ca6);}return null;};}function saveUpdates(_0x1edff0){return function(_0x319592){const _0x415aa8=a815_0x1877;if(_0x319592)return _0x319592[_0x415aa8('0x13')](_0x1edff0)[_0x415aa8('0x19')](function(_0x46f105){return _0x46f105;});return null;};}function removeEntity(_0x37d752){return function(_0x502256){const _0x4b4f6b=a815_0x1877;if(_0x502256)return _0x502256[_0x4b4f6b('0x1d')]()[_0x4b4f6b('0x19')](function(){const _0x252df7=_0x4b4f6b;_0x37d752[_0x252df7('0x18')](0xcc)[_0x252df7('0x5')]();});};}function handleEntityNotFound(_0x526d9d){return function(_0x4dd5c2){const _0x5889d0=a815_0x1877;return!_0x4dd5c2&&_0x526d9d[_0x5889d0('0x26')](0x194),_0x4dd5c2;};}function handleError(_0x3f8483,_0xe194ad){return _0xe194ad=_0xe194ad||0x1f4,function(_0x20af7d){const _0x58be23=a815_0x1877;logger[_0x58be23('0xb')](_0x20af7d[_0x58be23('0x1c')]),_0x20af7d[_0x58be23('0x25')]&&delete _0x20af7d[_0x58be23('0x25')],_0x3f8483[_0x58be23('0x18')](_0xe194ad)[_0x58be23('0x2a')](_0x20af7d);};}exports[_0x26fb93('0x12')]=function(_0x3103b1,_0x239931){const _0x4b12fc=_0x26fb93;let _0x54d354={};const _0x780295={},_0x14b49f={'count':0x0,'rows':[]},_0x52f7f1=_[_0x4b12fc('0x1a')](db[_0x4b12fc('0x34')]['rawAttributes'],function(_0x2e5b2e){const _0x22d20c=_0x4b12fc;return{'name':_0x2e5b2e[_0x22d20c('0x2f')],'type':_0x2e5b2e[_0x22d20c('0xf')][_0x22d20c('0x16')]};});_0x780295['model']=_[_0x4b12fc('0x1a')](_0x52f7f1,_0x4b12fc('0x25')),_0x780295[_0x4b12fc('0x3')]=_[_0x4b12fc('0x0')](_0x3103b1[_0x4b12fc('0x3')]),_0x780295['filters']=_['intersection'](_0x780295[_0x4b12fc('0x1b')],_0x780295['query']),_0x54d354['attributes']=_[_0x4b12fc('0x10')](_0x780295['model'],qs[_0x4b12fc('0x1')](_0x3103b1[_0x4b12fc('0x3')][_0x4b12fc('0x1')])),_0x54d354[_0x4b12fc('0x32')]=_0x54d354['attributes']['length']?_0x54d354[_0x4b12fc('0x32')]:_0x780295[_0x4b12fc('0x1b')];typeof _0x3103b1[_0x4b12fc('0x3')][_0x4b12fc('0xc')]===_0x4b12fc('0x24')&&(_0x54d354['limit']=qs['limit'](_0x3103b1[_0x4b12fc('0x3')][_0x4b12fc('0x1f')]),_0x54d354[_0x4b12fc('0x2c')]=qs[_0x4b12fc('0x2c')](_0x3103b1['query'][_0x4b12fc('0x2c')]));_0x54d354[_0x4b12fc('0x27')]=qs[_0x4b12fc('0x2')](_0x3103b1[_0x4b12fc('0x3')]['sort']),_0x54d354['where']=qs[_0x4b12fc('0x29')](_[_0x4b12fc('0x15')](_0x3103b1[_0x4b12fc('0x3')],_0x780295[_0x4b12fc('0x29')]),_0x52f7f1);_0x3103b1[_0x4b12fc('0x3')][_0x4b12fc('0x21')]&&(_0x54d354[_0x4b12fc('0x1e')]=_['merge'](_0x54d354['where'],{[Op['or']]:_['map'](_0x52f7f1,function(_0x1984ff){const _0x7abf=_0x4b12fc;if(_0x1984ff['type']!==_0x7abf('0x2e')){const _0x26aa20={};return _0x26aa20[_0x1984ff[_0x7abf('0x25')]]={[Op['like']]:'%'+_0x3103b1[_0x7abf('0x3')][_0x7abf('0x21')]+'%'},_0x26aa20;}})}));_0x54d354=_[_0x4b12fc('0x2d')]({},_0x54d354,_0x3103b1[_0x4b12fc('0x6')]);const _0x54be0d={'where':_0x54d354['where']};return db['WhatsappQueueReport'][_0x4b12fc('0xe')](_0x54be0d)['then'](function(_0x118878){const _0x5d132f=_0x4b12fc;return _0x14b49f[_0x5d132f('0xe')]=_0x118878,_0x3103b1[_0x5d132f('0x3')][_0x5d132f('0x2b')]&&(_0x54d354['include']=[{'all':!![]}]),db[_0x5d132f('0x34')][_0x5d132f('0x14')](_0x54d354);})[_0x4b12fc('0x19')](function(_0x274b56){const _0xba072e=_0x4b12fc;return _0x14b49f[_0xba072e('0x33')]=_0x274b56,_0x14b49f;})[_0x4b12fc('0x19')](respondWithFilteredResult(_0x239931,_0x54d354))[_0x4b12fc('0x7')](handleError(_0x239931,null));},exports[_0x26fb93('0x11')]=function(_0x5d5c7e,_0x412306){const _0x5390fd=_0x26fb93;let _0x26a51a={'raw':!![],'where':{'id':_0x5d5c7e['params']['id']}};const _0x1cb457={};return _0x1cb457['model']=_[_0x5390fd('0x0')](db['WhatsappQueueReport'][_0x5390fd('0x17')]),_0x1cb457[_0x5390fd('0x3')]=_[_0x5390fd('0x0')](_0x5d5c7e[_0x5390fd('0x3')]),_0x1cb457[_0x5390fd('0x29')]=_[_0x5390fd('0x10')](_0x1cb457['model'],_0x1cb457['query']),_0x26a51a[_0x5390fd('0x32')]=_[_0x5390fd('0x10')](_0x1cb457[_0x5390fd('0x1b')],qs['fields'](_0x5d5c7e[_0x5390fd('0x3')][_0x5390fd('0x1')])),_0x26a51a[_0x5390fd('0x32')]=_0x26a51a[_0x5390fd('0x32')][_0x5390fd('0x30')]?_0x26a51a[_0x5390fd('0x32')]:_0x1cb457['model'],_0x5d5c7e[_0x5390fd('0x3')][_0x5390fd('0x2b')]&&(_0x26a51a[_0x5390fd('0x22')]=[{'all':!![]}]),_0x26a51a=_['merge']({},_0x26a51a,_0x5d5c7e[_0x5390fd('0x6')]),db[_0x5390fd('0x34')][_0x5390fd('0x4')](_0x26a51a)[_0x5390fd('0x19')](handleEntityNotFound(_0x412306,null))[_0x5390fd('0x19')](respondWithResult(_0x412306,null))[_0x5390fd('0x7')](handleError(_0x412306,null));},exports[_0x26fb93('0x20')]=function(_0x42630b,_0x1559a5){const _0x29600c=_0x26fb93;return db[_0x29600c('0x34')]['create'](_0x42630b['body'],{})[_0x29600c('0x19')](respondWithResult(_0x1559a5,0xc9))[_0x29600c('0x7')](handleError(_0x1559a5,null));},exports[_0x26fb93('0x13')]=function(_0x52caea,_0x1f507f){const _0x563ce7=_0x26fb93;return _0x52caea['body']['id']&&delete _0x52caea[_0x563ce7('0xa')]['id'],db[_0x563ce7('0x34')][_0x563ce7('0x4')]({'where':{'id':_0x52caea[_0x563ce7('0x8')]['id']}})[_0x563ce7('0x19')](handleEntityNotFound(_0x1f507f,null))['then'](saveUpdates(_0x52caea[_0x563ce7('0xa')],null))[_0x563ce7('0x19')](respondWithResult(_0x1f507f,null))['catch'](handleError(_0x1f507f,null));},exports[_0x26fb93('0x1d')]=function(_0x407587,_0x4ce726){const _0x25cec9=_0x26fb93;return db['WhatsappQueueReport'][_0x25cec9('0x4')]({'where':{'id':_0x407587[_0x25cec9('0x8')]['id']}})['then'](handleEntityNotFound(_0x4ce726,null))[_0x25cec9('0x19')](removeEntity(_0x4ce726,null))['catch'](handleError(_0x4ce726,null));},exports['describe']=function(_0x22a161,_0x11ee6a){const _0x1e0172=_0x26fb93;return db['WhatsappQueueReport'][_0x1e0172('0x28')]()['then'](respondWithResult(_0x11ee6a,null))[_0x1e0172('0x7')](handleError(_0x11ee6a,null));};
\ No newline at end of file
+const a815_0x9836=['map','options','sequelize','VIRTUAL','stack','query','WhatsappQueueReport','describe','index','catch','end','destroy','error','rows','key','json','undefined','model','count','merge','where','params','then','sendStatus','name','sort','type','rawAttributes','keys','fieldName','Content-Range','fields','send','filter','../../components/parsers/qs','filters','includeAll','intersection','attributes','length','../../config/logger','create','offset','body','findAll','limit','pick','findOne','include','status','set','like'];(function(_0x507b0c,_0x9836d4){const _0x56a29b=function(_0x19ecc8){while(--_0x19ecc8){_0x507b0c['push'](_0x507b0c['shift']());}};_0x56a29b(++_0x9836d4);}(a815_0x9836,0x92));const a815_0x56a2=function(_0x507b0c,_0x9836d4){_0x507b0c=_0x507b0c-0x0;let _0x56a29b=a815_0x9836[_0x507b0c];return _0x56a29b;};const _0x2a74e1=a815_0x56a2;'use strict';const _=require('lodash'),qs=require(_0x2a74e1('0x2c')),logger=require(_0x2a74e1('0x32'))('api'),db=require('../../mysqldb')['db'],{Op}=require(_0x2a74e1('0xc'));function respondWithResult(_0x19ecc8,_0x397ab9){return _0x397ab9=_0x397ab9||0xc8,function(_0x3ca9df){const _0x3db70f=a815_0x56a2;if(_0x3ca9df)return _0x19ecc8[_0x3db70f('0x7')](_0x397ab9)[_0x3db70f('0x19')](_0x3ca9df);};}function respondWithFilteredResult(_0x1a6cdc,_0x2eb793){return function(_0x3f1546){const _0x2192c8=a815_0x56a2;if(_0x3f1546){const _0xa8c338=_0x3f1546[_0x2192c8('0x1c')],_0x45dc6d=_0x2eb793['offset'];let _0x5ce93a=_0x2eb793[_0x2192c8('0x0')]+_0x2eb793[_0x2192c8('0x3')],_0x24ff15;return _0x5ce93a>=_0xa8c338?(_0x5ce93a=_0xa8c338,_0x24ff15=0xc8):_0x24ff15=0xce,_0x1a6cdc[_0x2192c8('0x7')](_0x24ff15),_0x1a6cdc[_0x2192c8('0x8')](_0x2192c8('0x28'),_0x45dc6d+'-'+_0x5ce93a+'/'+_0xa8c338)[_0x2192c8('0x19')](_0x3f1546);}return null;};}function saveUpdates(_0x4a16fb){return function(_0x1a73ba){const _0x243768=a815_0x56a2;if(_0x1a73ba)return _0x1a73ba['update'](_0x4a16fb)[_0x243768('0x20')](function(_0x2f485f){return _0x2f485f;});return null;};}function removeEntity(_0x133471){return function(_0x3c77e2){const _0x15194c=a815_0x56a2;if(_0x3c77e2)return _0x3c77e2[_0x15194c('0x15')]()['then'](function(){const _0x423df4=_0x15194c;_0x133471['status'](0xcc)[_0x423df4('0x14')]();});};}function handleEntityNotFound(_0x2ea4ce){return function(_0x3cc12d){const _0x34b9e0=a815_0x56a2;return!_0x3cc12d&&_0x2ea4ce[_0x34b9e0('0x21')](0x194),_0x3cc12d;};}function handleError(_0xf7e458,_0x3e00f0){return _0x3e00f0=_0x3e00f0||0x1f4,function(_0x4116ae){const _0x212208=a815_0x56a2;logger[_0x212208('0x16')](_0x4116ae[_0x212208('0xe')]),_0x4116ae[_0x212208('0x22')]&&delete _0x4116ae['name'],_0xf7e458[_0x212208('0x7')](_0x3e00f0)[_0x212208('0x2a')](_0x4116ae);};}exports[_0x2a74e1('0x12')]=function(_0x6bfc9d,_0x4d8cde){const _0x52915a=_0x2a74e1;let _0x1f4312={};const _0x140982={},_0x5562e4={'count':0x0,'rows':[]},_0x537f74=_[_0x52915a('0xa')](db['WhatsappQueueReport'][_0x52915a('0x25')],function(_0x4578c2){const _0x26d9cc=_0x52915a;return{'name':_0x4578c2[_0x26d9cc('0x27')],'type':_0x4578c2[_0x26d9cc('0x24')][_0x26d9cc('0x18')]};});_0x140982[_0x52915a('0x1b')]=_[_0x52915a('0xa')](_0x537f74,_0x52915a('0x22')),_0x140982['query']=_[_0x52915a('0x26')](_0x6bfc9d['query']),_0x140982['filters']=_[_0x52915a('0x2f')](_0x140982['model'],_0x140982[_0x52915a('0xf')]),_0x1f4312['attributes']=_[_0x52915a('0x2f')](_0x140982[_0x52915a('0x1b')],qs['fields'](_0x6bfc9d[_0x52915a('0xf')][_0x52915a('0x29')])),_0x1f4312[_0x52915a('0x30')]=_0x1f4312['attributes'][_0x52915a('0x31')]?_0x1f4312[_0x52915a('0x30')]:_0x140982[_0x52915a('0x1b')];typeof _0x6bfc9d[_0x52915a('0xf')]['nolimit']===_0x52915a('0x1a')&&(_0x1f4312[_0x52915a('0x3')]=qs[_0x52915a('0x3')](_0x6bfc9d[_0x52915a('0xf')][_0x52915a('0x3')]),_0x1f4312[_0x52915a('0x0')]=qs[_0x52915a('0x0')](_0x6bfc9d[_0x52915a('0xf')][_0x52915a('0x0')]));_0x1f4312['order']=qs[_0x52915a('0x23')](_0x6bfc9d['query'][_0x52915a('0x23')]),_0x1f4312[_0x52915a('0x1e')]=qs['filters'](_[_0x52915a('0x4')](_0x6bfc9d['query'],_0x140982[_0x52915a('0x2d')]),_0x537f74);_0x6bfc9d[_0x52915a('0xf')][_0x52915a('0x2b')]&&(_0x1f4312[_0x52915a('0x1e')]=_[_0x52915a('0x1d')](_0x1f4312['where'],{[Op['or']]:_[_0x52915a('0xa')](_0x537f74,function(_0x58bb6c){const _0x57a881=_0x52915a;if(_0x58bb6c[_0x57a881('0x24')]!==_0x57a881('0xd')){const _0x166650={};return _0x166650[_0x58bb6c[_0x57a881('0x22')]]={[Op[_0x57a881('0x9')]]:'%'+_0x6bfc9d[_0x57a881('0xf')]['filter']+'%'},_0x166650;}})}));_0x1f4312=_[_0x52915a('0x1d')]({},_0x1f4312,_0x6bfc9d[_0x52915a('0xb')]);const _0x551142={'where':_0x1f4312[_0x52915a('0x1e')]};return db[_0x52915a('0x10')][_0x52915a('0x1c')](_0x551142)['then'](function(_0x2c9648){const _0x2098cc=_0x52915a;return _0x5562e4[_0x2098cc('0x1c')]=_0x2c9648,_0x6bfc9d['query'][_0x2098cc('0x2e')]&&(_0x1f4312[_0x2098cc('0x6')]=[{'all':!![]}]),db[_0x2098cc('0x10')][_0x2098cc('0x2')](_0x1f4312);})[_0x52915a('0x20')](function(_0x48b384){const _0x94c7db=_0x52915a;return _0x5562e4[_0x94c7db('0x17')]=_0x48b384,_0x5562e4;})['then'](respondWithFilteredResult(_0x4d8cde,_0x1f4312))[_0x52915a('0x13')](handleError(_0x4d8cde,null));},exports['show']=function(_0x5c61b6,_0x54a971){const _0x1410b6=_0x2a74e1;let _0x8e36b={'raw':!![],'where':{'id':_0x5c61b6[_0x1410b6('0x1f')]['id']}};const _0xcfaab6={};return _0xcfaab6[_0x1410b6('0x1b')]=_[_0x1410b6('0x26')](db[_0x1410b6('0x10')][_0x1410b6('0x25')]),_0xcfaab6[_0x1410b6('0xf')]=_['keys'](_0x5c61b6['query']),_0xcfaab6[_0x1410b6('0x2d')]=_[_0x1410b6('0x2f')](_0xcfaab6[_0x1410b6('0x1b')],_0xcfaab6['query']),_0x8e36b[_0x1410b6('0x30')]=_[_0x1410b6('0x2f')](_0xcfaab6['model'],qs[_0x1410b6('0x29')](_0x5c61b6['query'][_0x1410b6('0x29')])),_0x8e36b[_0x1410b6('0x30')]=_0x8e36b[_0x1410b6('0x30')]['length']?_0x8e36b[_0x1410b6('0x30')]:_0xcfaab6['model'],_0x5c61b6[_0x1410b6('0xf')][_0x1410b6('0x2e')]&&(_0x8e36b[_0x1410b6('0x6')]=[{'all':!![]}]),_0x8e36b=_[_0x1410b6('0x1d')]({},_0x8e36b,_0x5c61b6['options']),db[_0x1410b6('0x10')][_0x1410b6('0x5')](_0x8e36b)[_0x1410b6('0x20')](handleEntityNotFound(_0x54a971,null))['then'](respondWithResult(_0x54a971,null))[_0x1410b6('0x13')](handleError(_0x54a971,null));},exports[_0x2a74e1('0x33')]=function(_0x3f65d5,_0x320fa0){const _0x4c6090=_0x2a74e1;return db['WhatsappQueueReport'][_0x4c6090('0x33')](_0x3f65d5[_0x4c6090('0x1')],{})[_0x4c6090('0x20')](respondWithResult(_0x320fa0,0xc9))['catch'](handleError(_0x320fa0,null));},exports['update']=function(_0x26f34b,_0x1e3828){const _0x353c4b=_0x2a74e1;return _0x26f34b[_0x353c4b('0x1')]['id']&&delete _0x26f34b[_0x353c4b('0x1')]['id'],db['WhatsappQueueReport'][_0x353c4b('0x5')]({'where':{'id':_0x26f34b[_0x353c4b('0x1f')]['id']}})[_0x353c4b('0x20')](handleEntityNotFound(_0x1e3828,null))[_0x353c4b('0x20')](saveUpdates(_0x26f34b[_0x353c4b('0x1')],null))[_0x353c4b('0x20')](respondWithResult(_0x1e3828,null))[_0x353c4b('0x13')](handleError(_0x1e3828,null));},exports[_0x2a74e1('0x15')]=function(_0x1401fe,_0x373737){const _0xb00488=_0x2a74e1;return db[_0xb00488('0x10')]['findOne']({'where':{'id':_0x1401fe[_0xb00488('0x1f')]['id']}})[_0xb00488('0x20')](handleEntityNotFound(_0x373737,null))[_0xb00488('0x20')](removeEntity(_0x373737,null))[_0xb00488('0x13')](handleError(_0x373737,null));},exports[_0x2a74e1('0x11')]=function(_0x115f5f,_0x1f0b0c){const _0x2e14d7=_0x2a74e1;return db[_0x2e14d7('0x10')][_0x2e14d7('0x11')]()[_0x2e14d7('0x20')](respondWithResult(_0x1f0b0c,null))[_0x2e14d7('0x13')](handleError(_0x1f0b0c,null));};
\ No newline at end of file