Built motion from commit aab208717af8d15f4fa224cdb6a202877019af9b. Version 3.0.0...
[motion-next.git] / server / api / whatsappQueueReport / whatsappQueueReport.controller.js
index 9791a41..55b7108 100644 (file)
@@ -1 +1 @@
-const a815_0x3058=['status','order','type','query','then','error','options','nolimit','key','../../mysqldb','intersection','update','name','merge','body','model','fieldName','WhatsappQueueReport','filters','map','../../config/logger','keys','api','sort','params','set','includeAll','describe','findOne','where','limit','lodash','create','length','pick','filter','include','fields','destroy','send','like','index','catch','undefined','../../components/parsers/qs','show','rawAttributes','offset','attributes','end','count','stack'];(function(_0x3eccb4,_0x305821){const _0x5163fe=function(_0x88c95d){while(--_0x88c95d){_0x3eccb4['push'](_0x3eccb4['shift']());}};_0x5163fe(++_0x305821);}(a815_0x3058,0xf3));const a815_0x5163=function(_0x3eccb4,_0x305821){_0x3eccb4=_0x3eccb4-0x0;let _0x5163fe=a815_0x3058[_0x3eccb4];return _0x5163fe;};const _0x5423f0=a815_0x5163;'use strict';const _=require(_0x5423f0('0x30')),qs=require(_0x5423f0('0x9')),logger=require(_0x5423f0('0x25'))(_0x5423f0('0x27')),db=require(_0x5423f0('0x1a'))['db'],{Op}=require('sequelize');function respondWithResult(_0x88c95d,_0x40a5aa){return _0x40a5aa=_0x40a5aa||0xc8,function(_0x1cbc6b){const _0x5e5a25=a815_0x5163;if(_0x1cbc6b)return _0x88c95d[_0x5e5a25('0x11')](_0x40a5aa)['json'](_0x1cbc6b);};}function respondWithFilteredResult(_0x3ef89c,_0x1f94e5){return function(_0x57e74b){const _0x2756b4=a815_0x5163;if(_0x57e74b){const _0x3e5510=_0x57e74b[_0x2756b4('0xf')],_0x2224f5=_0x1f94e5[_0x2756b4('0xc')];let _0xbef966=_0x1f94e5[_0x2756b4('0xc')]+_0x1f94e5[_0x2756b4('0x2f')],_0x55bfc5;return _0xbef966>=_0x3e5510?(_0xbef966=_0x3e5510,_0x55bfc5=0xc8):_0x55bfc5=0xce,_0x3ef89c['status'](_0x55bfc5),_0x3ef89c[_0x2756b4('0x2a')]('Content-Range',_0x2224f5+'-'+_0xbef966+'/'+_0x3e5510)['json'](_0x57e74b);}return null;};}function saveUpdates(_0x14da81){return function(_0x4f4eca){const _0xf4b47=a815_0x5163;if(_0x4f4eca)return _0x4f4eca['update'](_0x14da81)[_0xf4b47('0x15')](function(_0x4054d9){return _0x4054d9;});return null;};}function removeEntity(_0x946245){return function(_0x305249){const _0x7f26e1=a815_0x5163;if(_0x305249)return _0x305249[_0x7f26e1('0x3')]()[_0x7f26e1('0x15')](function(){const _0x9a74d3=_0x7f26e1;_0x946245[_0x9a74d3('0x11')](0xcc)[_0x9a74d3('0xe')]();});};}function handleEntityNotFound(_0x2ee869){return function(_0x3d04ed){return!_0x3d04ed&&_0x2ee869['sendStatus'](0x194),_0x3d04ed;};}function handleError(_0x156c16,_0x47264b){return _0x47264b=_0x47264b||0x1f4,function(_0x14e46e){const _0x17c0d6=a815_0x5163;logger[_0x17c0d6('0x16')](_0x14e46e[_0x17c0d6('0x10')]),_0x14e46e['name']&&delete _0x14e46e[_0x17c0d6('0x1d')],_0x156c16['status'](_0x47264b)[_0x17c0d6('0x4')](_0x14e46e);};}exports[_0x5423f0('0x6')]=function(_0x3e99f5,_0x5d759d){const _0x25ce76=_0x5423f0;let _0xbc9d08={};const _0x155443={},_0x3825af={'count':0x0,'rows':[]},_0x192a1d=_[_0x25ce76('0x24')](db['WhatsappQueueReport']['rawAttributes'],function(_0xa0ddec){const _0x3d35da=_0x25ce76;return{'name':_0xa0ddec[_0x3d35da('0x21')],'type':_0xa0ddec[_0x3d35da('0x13')][_0x3d35da('0x19')]};});_0x155443[_0x25ce76('0x20')]=_[_0x25ce76('0x24')](_0x192a1d,_0x25ce76('0x1d')),_0x155443['query']=_[_0x25ce76('0x26')](_0x3e99f5[_0x25ce76('0x14')]),_0x155443['filters']=_[_0x25ce76('0x1b')](_0x155443[_0x25ce76('0x20')],_0x155443[_0x25ce76('0x14')]),_0xbc9d08[_0x25ce76('0xd')]=_[_0x25ce76('0x1b')](_0x155443['model'],qs['fields'](_0x3e99f5['query'][_0x25ce76('0x2')])),_0xbc9d08[_0x25ce76('0xd')]=_0xbc9d08[_0x25ce76('0xd')]['length']?_0xbc9d08[_0x25ce76('0xd')]:_0x155443['model'];typeof _0x3e99f5['query'][_0x25ce76('0x18')]===_0x25ce76('0x8')&&(_0xbc9d08[_0x25ce76('0x2f')]=qs[_0x25ce76('0x2f')](_0x3e99f5[_0x25ce76('0x14')][_0x25ce76('0x2f')]),_0xbc9d08['offset']=qs[_0x25ce76('0xc')](_0x3e99f5[_0x25ce76('0x14')]['offset']));_0xbc9d08[_0x25ce76('0x12')]=qs[_0x25ce76('0x28')](_0x3e99f5['query']['sort']),_0xbc9d08[_0x25ce76('0x2e')]=qs['filters'](_[_0x25ce76('0x33')](_0x3e99f5['query'],_0x155443['filters']),_0x192a1d);_0x3e99f5['query'][_0x25ce76('0x0')]&&(_0xbc9d08[_0x25ce76('0x2e')]=_[_0x25ce76('0x1e')](_0xbc9d08[_0x25ce76('0x2e')],{[Op['or']]:_[_0x25ce76('0x24')](_0x192a1d,function(_0x4ffcaa){const _0x483471=_0x25ce76;if(_0x4ffcaa[_0x483471('0x13')]!=='VIRTUAL'){const _0x2845dc={};return _0x2845dc[_0x4ffcaa[_0x483471('0x1d')]]={[Op[_0x483471('0x5')]]:'%'+_0x3e99f5['query'][_0x483471('0x0')]+'%'},_0x2845dc;}})}));_0xbc9d08=_[_0x25ce76('0x1e')]({},_0xbc9d08,_0x3e99f5[_0x25ce76('0x17')]);const _0x1bdba1={'where':_0xbc9d08[_0x25ce76('0x2e')]};return db[_0x25ce76('0x22')][_0x25ce76('0xf')](_0x1bdba1)['then'](function(_0x13876f){const _0x4ca882=_0x25ce76;return _0x3825af[_0x4ca882('0xf')]=_0x13876f,_0x3e99f5[_0x4ca882('0x14')][_0x4ca882('0x2b')]&&(_0xbc9d08[_0x4ca882('0x1')]=[{'all':!![]}]),db['WhatsappQueueReport']['findAll'](_0xbc9d08);})[_0x25ce76('0x15')](function(_0x1ab514){return _0x3825af['rows']=_0x1ab514,_0x3825af;})[_0x25ce76('0x15')](respondWithFilteredResult(_0x5d759d,_0xbc9d08))[_0x25ce76('0x7')](handleError(_0x5d759d,null));},exports[_0x5423f0('0xa')]=function(_0x46b6f5,_0xa8e7ba){const _0x406c81=_0x5423f0;let _0x450b02={'raw':!![],'where':{'id':_0x46b6f5[_0x406c81('0x29')]['id']}};const _0x32dfb0={};return _0x32dfb0[_0x406c81('0x20')]=_['keys'](db[_0x406c81('0x22')][_0x406c81('0xb')]),_0x32dfb0[_0x406c81('0x14')]=_[_0x406c81('0x26')](_0x46b6f5[_0x406c81('0x14')]),_0x32dfb0[_0x406c81('0x23')]=_[_0x406c81('0x1b')](_0x32dfb0[_0x406c81('0x20')],_0x32dfb0['query']),_0x450b02['attributes']=_['intersection'](_0x32dfb0['model'],qs[_0x406c81('0x2')](_0x46b6f5['query'][_0x406c81('0x2')])),_0x450b02['attributes']=_0x450b02[_0x406c81('0xd')][_0x406c81('0x32')]?_0x450b02[_0x406c81('0xd')]:_0x32dfb0[_0x406c81('0x20')],_0x46b6f5['query'][_0x406c81('0x2b')]&&(_0x450b02[_0x406c81('0x1')]=[{'all':!![]}]),_0x450b02=_[_0x406c81('0x1e')]({},_0x450b02,_0x46b6f5[_0x406c81('0x17')]),db['WhatsappQueueReport']['findOne'](_0x450b02)[_0x406c81('0x15')](handleEntityNotFound(_0xa8e7ba,null))[_0x406c81('0x15')](respondWithResult(_0xa8e7ba,null))[_0x406c81('0x7')](handleError(_0xa8e7ba,null));},exports[_0x5423f0('0x31')]=function(_0x2dbad3,_0x3f95ea){const _0x3a5445=_0x5423f0;return db[_0x3a5445('0x22')][_0x3a5445('0x31')](_0x2dbad3[_0x3a5445('0x1f')],{})[_0x3a5445('0x15')](respondWithResult(_0x3f95ea,0xc9))[_0x3a5445('0x7')](handleError(_0x3f95ea,null));},exports[_0x5423f0('0x1c')]=function(_0x350082,_0x4d086c){const _0x200d6f=_0x5423f0;return _0x350082['body']['id']&&delete _0x350082[_0x200d6f('0x1f')]['id'],db[_0x200d6f('0x22')][_0x200d6f('0x2d')]({'where':{'id':_0x350082[_0x200d6f('0x29')]['id']}})[_0x200d6f('0x15')](handleEntityNotFound(_0x4d086c,null))['then'](saveUpdates(_0x350082[_0x200d6f('0x1f')],null))[_0x200d6f('0x15')](respondWithResult(_0x4d086c,null))[_0x200d6f('0x7')](handleError(_0x4d086c,null));},exports[_0x5423f0('0x3')]=function(_0x117f8a,_0xac7f7d){const _0x4228d1=_0x5423f0;return db['WhatsappQueueReport']['findOne']({'where':{'id':_0x117f8a[_0x4228d1('0x29')]['id']}})['then'](handleEntityNotFound(_0xac7f7d,null))['then'](removeEntity(_0xac7f7d,null))['catch'](handleError(_0xac7f7d,null));},exports[_0x5423f0('0x2c')]=function(_0x581f02,_0x41c2c7){const _0x1ad87a=_0x5423f0;return db[_0x1ad87a('0x22')][_0x1ad87a('0x2c')]()[_0x1ad87a('0x15')](respondWithResult(_0x41c2c7,null))[_0x1ad87a('0x7')](handleError(_0x41c2c7,null));};
\ No newline at end of file
+const a815_0x3718=['index','create','count','include','where','../../mysqldb','Content-Range','json','filters','set','rows','body','includeAll','pick','then','query','nolimit','VIRTUAL','map','catch','stack','params','rawAttributes','lodash','merge','length','findOne','filter','intersection','WhatsappQueueReport','status','send','undefined','model','offset','sendStatus','fields','name','order','fieldName','update','end','attributes','describe','limit','../../components/parsers/qs','options','sort','keys','type','destroy'];(function(_0x373276,_0x3718f3){const _0x4387c0=function(_0x48c667){while(--_0x48c667){_0x373276['push'](_0x373276['shift']());}};_0x4387c0(++_0x3718f3);}(a815_0x3718,0x1ca));const a815_0x4387=function(_0x373276,_0x3718f3){_0x373276=_0x373276-0x0;let _0x4387c0=a815_0x3718[_0x373276];return _0x4387c0;};const _0x48fffb=a815_0x4387;'use strict';const _=require(_0x48fffb('0x18')),qs=require(_0x48fffb('0x2e')),logger=require('../../config/logger')('api'),db=require(_0x48fffb('0x6'))['db'],{Op}=require('sequelize');function respondWithResult(_0x48c667,_0x395cca){return _0x395cca=_0x395cca||0xc8,function(_0x153cf7){const _0x5120dc=a815_0x4387;if(_0x153cf7)return _0x48c667[_0x5120dc('0x1f')](_0x395cca)[_0x5120dc('0x8')](_0x153cf7);};}function respondWithFilteredResult(_0x55afee,_0x11eca9){return function(_0x582ebe){const _0x53a8ff=a815_0x4387;if(_0x582ebe){const _0xc67a5=_0x582ebe['count'],_0x18ff17=_0x11eca9[_0x53a8ff('0x23')];let _0x416797=_0x11eca9['offset']+_0x11eca9['limit'],_0x2cc262;return _0x416797>=_0xc67a5?(_0x416797=_0xc67a5,_0x2cc262=0xc8):_0x2cc262=0xce,_0x55afee[_0x53a8ff('0x1f')](_0x2cc262),_0x55afee[_0x53a8ff('0xa')](_0x53a8ff('0x7'),_0x18ff17+'-'+_0x416797+'/'+_0xc67a5)['json'](_0x582ebe);}return null;};}function saveUpdates(_0x315eba){return function(_0x2d92a0){const _0x864bdd=a815_0x4387;if(_0x2d92a0)return _0x2d92a0[_0x864bdd('0x29')](_0x315eba)[_0x864bdd('0xf')](function(_0x34a8c4){return _0x34a8c4;});return null;};}function removeEntity(_0xa9ad41){return function(_0x620855){const _0x149a83=a815_0x4387;if(_0x620855)return _0x620855['destroy']()[_0x149a83('0xf')](function(){const _0x1a5be2=_0x149a83;_0xa9ad41[_0x1a5be2('0x1f')](0xcc)[_0x1a5be2('0x2a')]();});};}function handleEntityNotFound(_0x46d00f){return function(_0x6f02ac){const _0x422ac2=a815_0x4387;return!_0x6f02ac&&_0x46d00f[_0x422ac2('0x24')](0x194),_0x6f02ac;};}function handleError(_0x19c87b,_0x37be2d){return _0x37be2d=_0x37be2d||0x1f4,function(_0x492994){const _0x494d76=a815_0x4387;logger['error'](_0x492994[_0x494d76('0x15')]),_0x492994[_0x494d76('0x26')]&&delete _0x492994[_0x494d76('0x26')],_0x19c87b['status'](_0x37be2d)[_0x494d76('0x20')](_0x492994);};}exports[_0x48fffb('0x1')]=function(_0x5e25ea,_0x3348a3){const _0x194b7f=_0x48fffb;let _0x2f64bf={};const _0x3c8325={},_0x219730={'count':0x0,'rows':[]},_0x5bfd0d=_[_0x194b7f('0x13')](db['WhatsappQueueReport'][_0x194b7f('0x17')],function(_0x41d8ca){const _0xcb0abc=_0x194b7f;return{'name':_0x41d8ca[_0xcb0abc('0x28')],'type':_0x41d8ca[_0xcb0abc('0x32')]['key']};});_0x3c8325[_0x194b7f('0x22')]=_[_0x194b7f('0x13')](_0x5bfd0d,'name'),_0x3c8325[_0x194b7f('0x10')]=_['keys'](_0x5e25ea[_0x194b7f('0x10')]),_0x3c8325[_0x194b7f('0x9')]=_[_0x194b7f('0x1d')](_0x3c8325[_0x194b7f('0x22')],_0x3c8325[_0x194b7f('0x10')]),_0x2f64bf['attributes']=_[_0x194b7f('0x1d')](_0x3c8325[_0x194b7f('0x22')],qs[_0x194b7f('0x25')](_0x5e25ea['query'][_0x194b7f('0x25')])),_0x2f64bf[_0x194b7f('0x2b')]=_0x2f64bf[_0x194b7f('0x2b')][_0x194b7f('0x1a')]?_0x2f64bf['attributes']:_0x3c8325[_0x194b7f('0x22')];typeof _0x5e25ea[_0x194b7f('0x10')][_0x194b7f('0x11')]===_0x194b7f('0x21')&&(_0x2f64bf[_0x194b7f('0x2d')]=qs['limit'](_0x5e25ea[_0x194b7f('0x10')]['limit']),_0x2f64bf[_0x194b7f('0x23')]=qs[_0x194b7f('0x23')](_0x5e25ea[_0x194b7f('0x10')][_0x194b7f('0x23')]));_0x2f64bf[_0x194b7f('0x27')]=qs[_0x194b7f('0x30')](_0x5e25ea[_0x194b7f('0x10')][_0x194b7f('0x30')]),_0x2f64bf['where']=qs[_0x194b7f('0x9')](_[_0x194b7f('0xe')](_0x5e25ea['query'],_0x3c8325[_0x194b7f('0x9')]),_0x5bfd0d);_0x5e25ea[_0x194b7f('0x10')][_0x194b7f('0x1c')]&&(_0x2f64bf[_0x194b7f('0x5')]=_[_0x194b7f('0x19')](_0x2f64bf[_0x194b7f('0x5')],{[Op['or']]:_[_0x194b7f('0x13')](_0x5bfd0d,function(_0x155e9f){const _0x3d2407=_0x194b7f;if(_0x155e9f[_0x3d2407('0x32')]!==_0x3d2407('0x12')){const _0x6473bf={};return _0x6473bf[_0x155e9f[_0x3d2407('0x26')]]={[Op['like']]:'%'+_0x5e25ea[_0x3d2407('0x10')][_0x3d2407('0x1c')]+'%'},_0x6473bf;}})}));_0x2f64bf=_[_0x194b7f('0x19')]({},_0x2f64bf,_0x5e25ea[_0x194b7f('0x2f')]);const _0x3ef66f={'where':_0x2f64bf[_0x194b7f('0x5')]};return db[_0x194b7f('0x1e')][_0x194b7f('0x3')](_0x3ef66f)['then'](function(_0x52868f){const _0xe90b7b=_0x194b7f;return _0x219730['count']=_0x52868f,_0x5e25ea[_0xe90b7b('0x10')][_0xe90b7b('0xd')]&&(_0x2f64bf[_0xe90b7b('0x4')]=[{'all':!![]}]),db['WhatsappQueueReport']['findAll'](_0x2f64bf);})['then'](function(_0x52367d){const _0x3c67bf=_0x194b7f;return _0x219730[_0x3c67bf('0xb')]=_0x52367d,_0x219730;})[_0x194b7f('0xf')](respondWithFilteredResult(_0x3348a3,_0x2f64bf))[_0x194b7f('0x14')](handleError(_0x3348a3,null));},exports['show']=function(_0x41a1ec,_0x1a6a90){const _0x265bef=_0x48fffb;let _0x574a6a={'raw':!![],'where':{'id':_0x41a1ec[_0x265bef('0x16')]['id']}};const _0x3ace21={};return _0x3ace21[_0x265bef('0x22')]=_['keys'](db['WhatsappQueueReport'][_0x265bef('0x17')]),_0x3ace21[_0x265bef('0x10')]=_[_0x265bef('0x31')](_0x41a1ec['query']),_0x3ace21['filters']=_[_0x265bef('0x1d')](_0x3ace21['model'],_0x3ace21[_0x265bef('0x10')]),_0x574a6a[_0x265bef('0x2b')]=_[_0x265bef('0x1d')](_0x3ace21[_0x265bef('0x22')],qs[_0x265bef('0x25')](_0x41a1ec[_0x265bef('0x10')][_0x265bef('0x25')])),_0x574a6a[_0x265bef('0x2b')]=_0x574a6a[_0x265bef('0x2b')]['length']?_0x574a6a[_0x265bef('0x2b')]:_0x3ace21[_0x265bef('0x22')],_0x41a1ec['query'][_0x265bef('0xd')]&&(_0x574a6a['include']=[{'all':!![]}]),_0x574a6a=_['merge']({},_0x574a6a,_0x41a1ec[_0x265bef('0x2f')]),db[_0x265bef('0x1e')][_0x265bef('0x1b')](_0x574a6a)[_0x265bef('0xf')](handleEntityNotFound(_0x1a6a90,null))[_0x265bef('0xf')](respondWithResult(_0x1a6a90,null))['catch'](handleError(_0x1a6a90,null));},exports[_0x48fffb('0x2')]=function(_0x1ce3e1,_0x528228){const _0x398705=_0x48fffb;return db[_0x398705('0x1e')][_0x398705('0x2')](_0x1ce3e1['body'],{})[_0x398705('0xf')](respondWithResult(_0x528228,0xc9))[_0x398705('0x14')](handleError(_0x528228,null));},exports[_0x48fffb('0x29')]=function(_0x46be38,_0x1118db){const _0x2c0e86=_0x48fffb;return _0x46be38['body']['id']&&delete _0x46be38['body']['id'],db['WhatsappQueueReport'][_0x2c0e86('0x1b')]({'where':{'id':_0x46be38[_0x2c0e86('0x16')]['id']}})[_0x2c0e86('0xf')](handleEntityNotFound(_0x1118db,null))[_0x2c0e86('0xf')](saveUpdates(_0x46be38[_0x2c0e86('0xc')],null))[_0x2c0e86('0xf')](respondWithResult(_0x1118db,null))['catch'](handleError(_0x1118db,null));},exports[_0x48fffb('0x0')]=function(_0x14e134,_0x381f4c){const _0x48f85d=_0x48fffb;return db['WhatsappQueueReport'][_0x48f85d('0x1b')]({'where':{'id':_0x14e134[_0x48f85d('0x16')]['id']}})['then'](handleEntityNotFound(_0x381f4c,null))[_0x48f85d('0xf')](removeEntity(_0x381f4c,null))[_0x48f85d('0x14')](handleError(_0x381f4c,null));},exports[_0x48fffb('0x2c')]=function(_0x59a3c9,_0x5b1912){const _0x35df4b=_0x48fffb;return db['WhatsappQueueReport'][_0x35df4b('0x2c')]()[_0x35df4b('0xf')](respondWithResult(_0x5b1912,null))[_0x35df4b('0x14')](handleError(_0x5b1912,null));};
\ No newline at end of file