c741e31a353ea4c2f607cd362a6e1ff9a3ab9198
[motion-next.git] / server / api / whatsappTransferReport / whatsappTransferReport.controller.js
1 const a820_0x150c=['limit','sort','name','includeAll','destroy','params','count','Content-Range','json','update','../../mysqldb','merge','rawAttributes','filter','api','index','map','set','model','fieldName','create','options','where','end','sendStatus','attributes','status','catch','then','VIRTUAL','filters','findOne','pick','show','findAll','length','fields','error','rows','keys','offset','lodash','type','nolimit','WhatsappTransferReport','order','key','body','intersection','../../config/logger','query','describe','include'];(function(_0x5de996,_0x150cde){const _0x11b531=function(_0x4672bb){while(--_0x4672bb){_0x5de996['push'](_0x5de996['shift']());}};_0x11b531(++_0x150cde);}(a820_0x150c,0x12f));const a820_0x11b5=function(_0x5de996,_0x150cde){_0x5de996=_0x5de996-0x0;let _0x11b531=a820_0x150c[_0x5de996];return _0x11b531;};const _0x3a66c6=a820_0x11b5;'use strict';const _=require(_0x3a66c6('0x3')),qs=require('../../components/parsers/qs'),logger=require(_0x3a66c6('0xb'))(_0x3a66c6('0x1d')),db=require(_0x3a66c6('0x19'))['db'],{Op}=require('sequelize');function respondWithResult(_0x4672bb,_0x3fd568){return _0x3fd568=_0x3fd568||0xc8,function(_0x2e3f9e){const _0x44f938=a820_0x11b5;if(_0x2e3f9e)return _0x4672bb['status'](_0x3fd568)[_0x44f938('0x17')](_0x2e3f9e);};}function respondWithFilteredResult(_0xffea88,_0x3e1309){return function(_0x44407c){const _0x272a10=a820_0x11b5;if(_0x44407c){const _0x564583=_0x44407c['count'],_0x5f30f5=_0x3e1309[_0x272a10('0x2')];let _0x18f5f6=_0x3e1309[_0x272a10('0x2')]+_0x3e1309['limit'],_0x3acf98;return _0x18f5f6>=_0x564583?(_0x18f5f6=_0x564583,_0x3acf98=0xc8):_0x3acf98=0xce,_0xffea88[_0x272a10('0x29')](_0x3acf98),_0xffea88[_0x272a10('0x20')](_0x272a10('0x16'),_0x5f30f5+'-'+_0x18f5f6+'/'+_0x564583)[_0x272a10('0x17')](_0x44407c);}return null;};}function saveUpdates(_0x2fd4b9){return function(_0x5997a1){const _0x2127e1=a820_0x11b5;if(_0x5997a1)return _0x5997a1['update'](_0x2fd4b9)[_0x2127e1('0x2b')](function(_0x40f1c8){return _0x40f1c8;});return null;};}function removeEntity(_0x374ecf){return function(_0x2cbfca){if(_0x2cbfca)return _0x2cbfca['destroy']()['then'](function(){const _0x58145d=a820_0x11b5;_0x374ecf[_0x58145d('0x29')](0xcc)[_0x58145d('0x26')]();});};}function handleEntityNotFound(_0x377194){return function(_0x14047a){const _0x3d9637=a820_0x11b5;return!_0x14047a&&_0x377194[_0x3d9637('0x27')](0x194),_0x14047a;};}function handleError(_0x223800,_0x2c146f){return _0x2c146f=_0x2c146f||0x1f4,function(_0x4e0108){const _0x2123f3=a820_0x11b5;logger[_0x2123f3('0x34')](_0x4e0108['stack']),_0x4e0108['name']&&delete _0x4e0108[_0x2123f3('0x11')],_0x223800['status'](_0x2c146f)['send'](_0x4e0108);};}exports[_0x3a66c6('0x1e')]=function(_0x1410db,_0x32136c){const _0x28a6c7=_0x3a66c6;let _0x12504b={};const _0x4edf65={},_0x4bfbbc={'count':0x0,'rows':[]},_0x53d0de=_['map'](db[_0x28a6c7('0x6')][_0x28a6c7('0x1b')],function(_0x29596d){const _0x83f1fc=_0x28a6c7;return{'name':_0x29596d[_0x83f1fc('0x22')],'type':_0x29596d['type'][_0x83f1fc('0x8')]};});_0x4edf65[_0x28a6c7('0x21')]=_[_0x28a6c7('0x1f')](_0x53d0de,_0x28a6c7('0x11')),_0x4edf65['query']=_[_0x28a6c7('0x1')](_0x1410db['query']),_0x4edf65[_0x28a6c7('0x2d')]=_[_0x28a6c7('0xa')](_0x4edf65[_0x28a6c7('0x21')],_0x4edf65[_0x28a6c7('0xc')]),_0x12504b[_0x28a6c7('0x28')]=_[_0x28a6c7('0xa')](_0x4edf65[_0x28a6c7('0x21')],qs[_0x28a6c7('0x33')](_0x1410db[_0x28a6c7('0xc')][_0x28a6c7('0x33')])),_0x12504b['attributes']=_0x12504b[_0x28a6c7('0x28')][_0x28a6c7('0x32')]?_0x12504b[_0x28a6c7('0x28')]:_0x4edf65[_0x28a6c7('0x21')];typeof _0x1410db[_0x28a6c7('0xc')][_0x28a6c7('0x5')]==='undefined'&&(_0x12504b[_0x28a6c7('0xf')]=qs[_0x28a6c7('0xf')](_0x1410db[_0x28a6c7('0xc')][_0x28a6c7('0xf')]),_0x12504b[_0x28a6c7('0x2')]=qs[_0x28a6c7('0x2')](_0x1410db['query'][_0x28a6c7('0x2')]));_0x12504b[_0x28a6c7('0x7')]=qs[_0x28a6c7('0x10')](_0x1410db['query'][_0x28a6c7('0x10')]),_0x12504b[_0x28a6c7('0x25')]=qs['filters'](_[_0x28a6c7('0x2f')](_0x1410db['query'],_0x4edf65[_0x28a6c7('0x2d')]),_0x53d0de);_0x1410db[_0x28a6c7('0xc')][_0x28a6c7('0x1c')]&&(_0x12504b[_0x28a6c7('0x25')]=_[_0x28a6c7('0x1a')](_0x12504b[_0x28a6c7('0x25')],{[Op['or']]:_[_0x28a6c7('0x1f')](_0x53d0de,function(_0x4af92b){const _0x549a12=_0x28a6c7;if(_0x4af92b[_0x549a12('0x4')]!==_0x549a12('0x2c')){const _0x304230={};return _0x304230[_0x4af92b[_0x549a12('0x11')]]={[Op['like']]:'%'+_0x1410db['query'][_0x549a12('0x1c')]+'%'},_0x304230;}})}));_0x12504b=_['merge']({},_0x12504b,_0x1410db[_0x28a6c7('0x24')]);const _0x5f30cd={'where':_0x12504b['where']};return db[_0x28a6c7('0x6')][_0x28a6c7('0x15')](_0x5f30cd)['then'](function(_0x32be1e){const _0xc7be55=_0x28a6c7;return _0x4bfbbc[_0xc7be55('0x15')]=_0x32be1e,_0x1410db[_0xc7be55('0xc')][_0xc7be55('0x12')]&&(_0x12504b[_0xc7be55('0xe')]=[{'all':!![]}]),db['WhatsappTransferReport'][_0xc7be55('0x31')](_0x12504b);})[_0x28a6c7('0x2b')](function(_0x412f17){const _0x5de258=_0x28a6c7;return _0x4bfbbc[_0x5de258('0x0')]=_0x412f17,_0x4bfbbc;})[_0x28a6c7('0x2b')](respondWithFilteredResult(_0x32136c,_0x12504b))[_0x28a6c7('0x2a')](handleError(_0x32136c,null));},exports[_0x3a66c6('0x30')]=function(_0x24c21c,_0x1f2eec){const _0x3c19f8=_0x3a66c6;let _0x4391ed={'raw':!![],'where':{'id':_0x24c21c[_0x3c19f8('0x14')]['id']}};const _0x45fca9={};return _0x45fca9[_0x3c19f8('0x21')]=_[_0x3c19f8('0x1')](db[_0x3c19f8('0x6')][_0x3c19f8('0x1b')]),_0x45fca9[_0x3c19f8('0xc')]=_[_0x3c19f8('0x1')](_0x24c21c[_0x3c19f8('0xc')]),_0x45fca9[_0x3c19f8('0x2d')]=_[_0x3c19f8('0xa')](_0x45fca9[_0x3c19f8('0x21')],_0x45fca9[_0x3c19f8('0xc')]),_0x4391ed['attributes']=_[_0x3c19f8('0xa')](_0x45fca9['model'],qs[_0x3c19f8('0x33')](_0x24c21c[_0x3c19f8('0xc')][_0x3c19f8('0x33')])),_0x4391ed['attributes']=_0x4391ed[_0x3c19f8('0x28')][_0x3c19f8('0x32')]?_0x4391ed['attributes']:_0x45fca9[_0x3c19f8('0x21')],_0x24c21c[_0x3c19f8('0xc')][_0x3c19f8('0x12')]&&(_0x4391ed[_0x3c19f8('0xe')]=[{'all':!![]}]),_0x4391ed=_[_0x3c19f8('0x1a')]({},_0x4391ed,_0x24c21c[_0x3c19f8('0x24')]),db[_0x3c19f8('0x6')][_0x3c19f8('0x2e')](_0x4391ed)[_0x3c19f8('0x2b')](handleEntityNotFound(_0x1f2eec,null))['then'](respondWithResult(_0x1f2eec,null))[_0x3c19f8('0x2a')](handleError(_0x1f2eec,null));},exports[_0x3a66c6('0x23')]=function(_0x1ce00b,_0x7487d3){const _0x5365e3=_0x3a66c6;return db[_0x5365e3('0x6')][_0x5365e3('0x23')](_0x1ce00b['body'],{})[_0x5365e3('0x2b')](respondWithResult(_0x7487d3,0xc9))[_0x5365e3('0x2a')](handleError(_0x7487d3,null));},exports[_0x3a66c6('0x18')]=function(_0x3c82b3,_0x3510f9){const _0x9c71f8=_0x3a66c6;return _0x3c82b3['body']['id']&&delete _0x3c82b3[_0x9c71f8('0x9')]['id'],db['WhatsappTransferReport']['findOne']({'where':{'id':_0x3c82b3[_0x9c71f8('0x14')]['id']}})[_0x9c71f8('0x2b')](handleEntityNotFound(_0x3510f9,null))[_0x9c71f8('0x2b')](saveUpdates(_0x3c82b3[_0x9c71f8('0x9')],null))[_0x9c71f8('0x2b')](respondWithResult(_0x3510f9,null))[_0x9c71f8('0x2a')](handleError(_0x3510f9,null));},exports[_0x3a66c6('0x13')]=function(_0xf06eb7,_0x42fbfd){const _0x7e25cb=_0x3a66c6;return db[_0x7e25cb('0x6')]['findOne']({'where':{'id':_0xf06eb7[_0x7e25cb('0x14')]['id']}})['then'](handleEntityNotFound(_0x42fbfd,null))[_0x7e25cb('0x2b')](removeEntity(_0x42fbfd,null))[_0x7e25cb('0x2a')](handleError(_0x42fbfd,null));},exports['describe']=function(_0x332c8b,_0x48707f){const _0x1a025d=_0x3a66c6;return db[_0x1a025d('0x6')][_0x1a025d('0xd')]()[_0x1a025d('0x2b')](respondWithResult(_0x48707f,null))[_0x1a025d('0x2a')](handleError(_0x48707f,null));};