48a08cf0d1f582ef3180484725b5743a60f1840d
[motion-next.git] / server / api / smsTransferReport / smsTransferReport.controller.js
1 const a579_0x15be=['options','query','destroy','count','lodash','then','limit','like','index','merge','map','fieldName','filter','../../mysqldb','VIRTUAL','stack','body','offset','catch','where','model','includeAll','keys','SmsTransferReport','create','../../components/parsers/qs','name','undefined','fields','json','rawAttributes','api','key','sort','include','update','intersection','Content-Range','sendStatus','findOne','length','sequelize','rows','attributes','describe','pick','filters','../../config/logger','status'];(function(_0xab923b,_0x15be7e){const _0x2c83e4=function(_0x50a5c4){while(--_0x50a5c4){_0xab923b['push'](_0xab923b['shift']());}};_0x2c83e4(++_0x15be7e);}(a579_0x15be,0x10f));const a579_0x2c83=function(_0xab923b,_0x15be7e){_0xab923b=_0xab923b-0x0;let _0x2c83e4=a579_0x15be[_0xab923b];return _0x2c83e4;};const _0x3c5f57=a579_0x2c83;'use strict';const _=require(_0x3c5f57('0x1b')),qs=require(_0x3c5f57('0x30')),logger=require(_0x3c5f57('0x15'))(_0x3c5f57('0x5')),db=require(_0x3c5f57('0x24'))['db'],{Op}=require(_0x3c5f57('0xf'));function respondWithResult(_0x50a5c4,_0x212c63){return _0x212c63=_0x212c63||0xc8,function(_0x240132){const _0x543cf7=a579_0x2c83;if(_0x240132)return _0x50a5c4[_0x543cf7('0x16')](_0x212c63)[_0x543cf7('0x3')](_0x240132);};}function respondWithFilteredResult(_0x49862a,_0x6d56ff){return function(_0x2e6394){const _0x42e073=a579_0x2c83;if(_0x2e6394){const _0x1a3fbd=_0x2e6394['count'],_0x24b8a0=_0x6d56ff[_0x42e073('0x28')];let _0x4f851d=_0x6d56ff[_0x42e073('0x28')]+_0x6d56ff[_0x42e073('0x1d')],_0x446977;return _0x4f851d>=_0x1a3fbd?(_0x4f851d=_0x1a3fbd,_0x446977=0xc8):_0x446977=0xce,_0x49862a[_0x42e073('0x16')](_0x446977),_0x49862a['set'](_0x42e073('0xb'),_0x24b8a0+'-'+_0x4f851d+'/'+_0x1a3fbd)[_0x42e073('0x3')](_0x2e6394);}return null;};}function saveUpdates(_0x2a86f4){return function(_0x456d28){const _0xcdefad=a579_0x2c83;if(_0x456d28)return _0x456d28[_0xcdefad('0x9')](_0x2a86f4)[_0xcdefad('0x1c')](function(_0x5b821d){return _0x5b821d;});return null;};}function removeEntity(_0x3df603){return function(_0x410c22){const _0x4e09e6=a579_0x2c83;if(_0x410c22)return _0x410c22[_0x4e09e6('0x19')]()['then'](function(){const _0x215220=_0x4e09e6;_0x3df603[_0x215220('0x16')](0xcc)['end']();});};}function handleEntityNotFound(_0x483be5){return function(_0x41de54){const _0x33644d=a579_0x2c83;return!_0x41de54&&_0x483be5[_0x33644d('0xc')](0x194),_0x41de54;};}function handleError(_0x348006,_0x240160){return _0x240160=_0x240160||0x1f4,function(_0x3d0242){const _0x50f4c7=a579_0x2c83;logger['error'](_0x3d0242[_0x50f4c7('0x26')]),_0x3d0242[_0x50f4c7('0x0')]&&delete _0x3d0242[_0x50f4c7('0x0')],_0x348006['status'](_0x240160)['send'](_0x3d0242);};}exports[_0x3c5f57('0x1f')]=function(_0x40857c,_0x781c6e){const _0x1556cf=_0x3c5f57;let _0x3be787={};const _0x3ddc16={},_0x522ba6={'count':0x0,'rows':[]},_0x2efbc6=_[_0x1556cf('0x21')](db[_0x1556cf('0x2e')][_0x1556cf('0x4')],function(_0xe83a8b){const _0x1a4df6=_0x1556cf;return{'name':_0xe83a8b[_0x1a4df6('0x22')],'type':_0xe83a8b['type'][_0x1a4df6('0x6')]};});_0x3ddc16['model']=_[_0x1556cf('0x21')](_0x2efbc6,_0x1556cf('0x0')),_0x3ddc16[_0x1556cf('0x18')]=_[_0x1556cf('0x2d')](_0x40857c[_0x1556cf('0x18')]),_0x3ddc16[_0x1556cf('0x14')]=_[_0x1556cf('0xa')](_0x3ddc16[_0x1556cf('0x2b')],_0x3ddc16[_0x1556cf('0x18')]),_0x3be787['attributes']=_[_0x1556cf('0xa')](_0x3ddc16[_0x1556cf('0x2b')],qs[_0x1556cf('0x2')](_0x40857c['query'][_0x1556cf('0x2')])),_0x3be787[_0x1556cf('0x11')]=_0x3be787['attributes'][_0x1556cf('0xe')]?_0x3be787['attributes']:_0x3ddc16['model'];typeof _0x40857c[_0x1556cf('0x18')]['nolimit']===_0x1556cf('0x1')&&(_0x3be787[_0x1556cf('0x1d')]=qs['limit'](_0x40857c['query'][_0x1556cf('0x1d')]),_0x3be787[_0x1556cf('0x28')]=qs['offset'](_0x40857c[_0x1556cf('0x18')][_0x1556cf('0x28')]));_0x3be787['order']=qs[_0x1556cf('0x7')](_0x40857c[_0x1556cf('0x18')][_0x1556cf('0x7')]),_0x3be787[_0x1556cf('0x2a')]=qs['filters'](_[_0x1556cf('0x13')](_0x40857c[_0x1556cf('0x18')],_0x3ddc16['filters']),_0x2efbc6);_0x40857c[_0x1556cf('0x18')][_0x1556cf('0x23')]&&(_0x3be787[_0x1556cf('0x2a')]=_[_0x1556cf('0x20')](_0x3be787[_0x1556cf('0x2a')],{[Op['or']]:_[_0x1556cf('0x21')](_0x2efbc6,function(_0x278d2a){const _0x44853e=_0x1556cf;if(_0x278d2a['type']!==_0x44853e('0x25')){const _0x45f3c4={};return _0x45f3c4[_0x278d2a['name']]={[Op[_0x44853e('0x1e')]]:'%'+_0x40857c[_0x44853e('0x18')][_0x44853e('0x23')]+'%'},_0x45f3c4;}})}));_0x3be787=_[_0x1556cf('0x20')]({},_0x3be787,_0x40857c['options']);const _0x3032a3={'where':_0x3be787[_0x1556cf('0x2a')]};return db[_0x1556cf('0x2e')][_0x1556cf('0x1a')](_0x3032a3)[_0x1556cf('0x1c')](function(_0x2e16ce){const _0x49f253=_0x1556cf;return _0x522ba6[_0x49f253('0x1a')]=_0x2e16ce,_0x40857c[_0x49f253('0x18')][_0x49f253('0x2c')]&&(_0x3be787['include']=[{'all':!![]}]),db[_0x49f253('0x2e')]['findAll'](_0x3be787);})[_0x1556cf('0x1c')](function(_0x7d1bc8){const _0x4c8f12=_0x1556cf;return _0x522ba6[_0x4c8f12('0x10')]=_0x7d1bc8,_0x522ba6;})[_0x1556cf('0x1c')](respondWithFilteredResult(_0x781c6e,_0x3be787))[_0x1556cf('0x29')](handleError(_0x781c6e,null));},exports['show']=function(_0x19ebaa,_0x30bf30){const _0x151279=_0x3c5f57;let _0x52d2af={'raw':!![],'where':{'id':_0x19ebaa['params']['id']}};const _0x48f777={};return _0x48f777[_0x151279('0x2b')]=_[_0x151279('0x2d')](db[_0x151279('0x2e')][_0x151279('0x4')]),_0x48f777['query']=_[_0x151279('0x2d')](_0x19ebaa[_0x151279('0x18')]),_0x48f777[_0x151279('0x14')]=_[_0x151279('0xa')](_0x48f777[_0x151279('0x2b')],_0x48f777[_0x151279('0x18')]),_0x52d2af[_0x151279('0x11')]=_[_0x151279('0xa')](_0x48f777['model'],qs[_0x151279('0x2')](_0x19ebaa[_0x151279('0x18')][_0x151279('0x2')])),_0x52d2af[_0x151279('0x11')]=_0x52d2af[_0x151279('0x11')][_0x151279('0xe')]?_0x52d2af[_0x151279('0x11')]:_0x48f777['model'],_0x19ebaa[_0x151279('0x18')][_0x151279('0x2c')]&&(_0x52d2af[_0x151279('0x8')]=[{'all':!![]}]),_0x52d2af=_[_0x151279('0x20')]({},_0x52d2af,_0x19ebaa[_0x151279('0x17')]),db[_0x151279('0x2e')]['findOne'](_0x52d2af)[_0x151279('0x1c')](handleEntityNotFound(_0x30bf30,null))[_0x151279('0x1c')](respondWithResult(_0x30bf30,null))['catch'](handleError(_0x30bf30,null));},exports[_0x3c5f57('0x2f')]=function(_0x135930,_0x325b1a){const _0x323a5d=_0x3c5f57;return db[_0x323a5d('0x2e')][_0x323a5d('0x2f')](_0x135930['body'],{})['then'](respondWithResult(_0x325b1a,0xc9))[_0x323a5d('0x29')](handleError(_0x325b1a,null));},exports[_0x3c5f57('0x9')]=function(_0x5e8101,_0x622f2e){const _0xc79c83=_0x3c5f57;return _0x5e8101[_0xc79c83('0x27')]['id']&&delete _0x5e8101[_0xc79c83('0x27')]['id'],db[_0xc79c83('0x2e')][_0xc79c83('0xd')]({'where':{'id':_0x5e8101['params']['id']}})[_0xc79c83('0x1c')](handleEntityNotFound(_0x622f2e,null))['then'](saveUpdates(_0x5e8101[_0xc79c83('0x27')],null))[_0xc79c83('0x1c')](respondWithResult(_0x622f2e,null))[_0xc79c83('0x29')](handleError(_0x622f2e,null));},exports['destroy']=function(_0x22eff2,_0x23b9a8){const _0x160f3b=_0x3c5f57;return db[_0x160f3b('0x2e')]['findOne']({'where':{'id':_0x22eff2['params']['id']}})[_0x160f3b('0x1c')](handleEntityNotFound(_0x23b9a8,null))[_0x160f3b('0x1c')](removeEntity(_0x23b9a8,null))['catch'](handleError(_0x23b9a8,null));},exports['describe']=function(_0x4263c1,_0x560174){const _0xc4b7a1=_0x3c5f57;return db[_0xc4b7a1('0x2e')][_0xc4b7a1('0x12')]()[_0xc4b7a1('0x1c')](respondWithResult(_0x560174,null))[_0xc4b7a1('0x29')](handleError(_0x560174,null));};