Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / smsTransferReport / smsTransferReport.controller.js
1 const a579_0x49a3=['../../mysqldb','limit','sendStatus','stack','send','show','filter','intersection','then','include','sort','attributes','destroy','where','body','status','offset','VIRTUAL','order','rawAttributes','findOne','SmsTransferReport','Content-Range','options','../../components/parsers/qs','update','fieldName','error','params','type','pick','end','includeAll','merge','../../config/logger','name','create','model','undefined','map','api','describe','count','query','fields','filters','catch','index','keys','findAll'];(function(_0x4273a4,_0x49a312){const _0xd560e7=function(_0x1b660f){while(--_0x1b660f){_0x4273a4['push'](_0x4273a4['shift']());}};_0xd560e7(++_0x49a312);}(a579_0x49a3,0x146));const a579_0xd560=function(_0x4273a4,_0x49a312){_0x4273a4=_0x4273a4-0x0;let _0xd560e7=a579_0x49a3[_0x4273a4];return _0xd560e7;};const _0xd40b0=a579_0xd560;'use strict';const _=require('lodash'),qs=require(_0xd40b0('0x30')),logger=require(_0xd40b0('0x8'))(_0xd40b0('0xe')),db=require(_0xd40b0('0x18'))['db'],{Op}=require('sequelize');function respondWithResult(_0x1b660f,_0x1a2c80){return _0x1a2c80=_0x1a2c80||0xc8,function(_0x172e68){const _0x1fef9d=a579_0xd560;if(_0x172e68)return _0x1b660f[_0x1fef9d('0x27')](_0x1a2c80)['json'](_0x172e68);};}function respondWithFilteredResult(_0x144a58,_0x112b77){return function(_0xdedab0){const _0x13d259=a579_0xd560;if(_0xdedab0){const _0x2b8770=_0xdedab0['count'],_0x570ea5=_0x112b77[_0x13d259('0x28')];let _0x462225=_0x112b77[_0x13d259('0x28')]+_0x112b77[_0x13d259('0x19')],_0x22b1d9;return _0x462225>=_0x2b8770?(_0x462225=_0x2b8770,_0x22b1d9=0xc8):_0x22b1d9=0xce,_0x144a58[_0x13d259('0x27')](_0x22b1d9),_0x144a58['set'](_0x13d259('0x2e'),_0x570ea5+'-'+_0x462225+'/'+_0x2b8770)['json'](_0xdedab0);}return null;};}function saveUpdates(_0x58de23){return function(_0x51b6f1){const _0x2bef2b=a579_0xd560;if(_0x51b6f1)return _0x51b6f1['update'](_0x58de23)[_0x2bef2b('0x20')](function(_0x17a596){return _0x17a596;});return null;};}function removeEntity(_0xa4dcb4){return function(_0x5319bb){if(_0x5319bb)return _0x5319bb['destroy']()['then'](function(){const _0x402d23=a579_0xd560;_0xa4dcb4[_0x402d23('0x27')](0xcc)[_0x402d23('0x5')]();});};}function handleEntityNotFound(_0x40bd61){return function(_0x580002){const _0x2dbc8b=a579_0xd560;return!_0x580002&&_0x40bd61[_0x2dbc8b('0x1a')](0x194),_0x580002;};}function handleError(_0x450862,_0x3814df){return _0x3814df=_0x3814df||0x1f4,function(_0x56e9d9){const _0x26138e=a579_0xd560;logger[_0x26138e('0x1')](_0x56e9d9[_0x26138e('0x1b')]),_0x56e9d9[_0x26138e('0x9')]&&delete _0x56e9d9[_0x26138e('0x9')],_0x450862['status'](_0x3814df)[_0x26138e('0x1c')](_0x56e9d9);};}exports[_0xd40b0('0x15')]=function(_0x203e5a,_0x5bbc1c){const _0x3d399e=_0xd40b0;let _0x3e6ce7={};const _0x18d2c9={},_0x16dbc0={'count':0x0,'rows':[]},_0x3eb9e3=_[_0x3d399e('0xd')](db[_0x3d399e('0x2d')][_0x3d399e('0x2b')],function(_0x1d73ad){const _0x5c0246=_0x3d399e;return{'name':_0x1d73ad[_0x5c0246('0x0')],'type':_0x1d73ad['type']['key']};});_0x18d2c9['model']=_['map'](_0x3eb9e3,_0x3d399e('0x9')),_0x18d2c9['query']=_[_0x3d399e('0x16')](_0x203e5a[_0x3d399e('0x11')]),_0x18d2c9[_0x3d399e('0x13')]=_[_0x3d399e('0x1f')](_0x18d2c9[_0x3d399e('0xb')],_0x18d2c9[_0x3d399e('0x11')]),_0x3e6ce7[_0x3d399e('0x23')]=_[_0x3d399e('0x1f')](_0x18d2c9[_0x3d399e('0xb')],qs['fields'](_0x203e5a[_0x3d399e('0x11')][_0x3d399e('0x12')])),_0x3e6ce7[_0x3d399e('0x23')]=_0x3e6ce7[_0x3d399e('0x23')]['length']?_0x3e6ce7[_0x3d399e('0x23')]:_0x18d2c9[_0x3d399e('0xb')];typeof _0x203e5a[_0x3d399e('0x11')]['nolimit']===_0x3d399e('0xc')&&(_0x3e6ce7[_0x3d399e('0x19')]=qs[_0x3d399e('0x19')](_0x203e5a[_0x3d399e('0x11')][_0x3d399e('0x19')]),_0x3e6ce7['offset']=qs[_0x3d399e('0x28')](_0x203e5a[_0x3d399e('0x11')][_0x3d399e('0x28')]));_0x3e6ce7[_0x3d399e('0x2a')]=qs[_0x3d399e('0x22')](_0x203e5a[_0x3d399e('0x11')][_0x3d399e('0x22')]),_0x3e6ce7[_0x3d399e('0x25')]=qs[_0x3d399e('0x13')](_[_0x3d399e('0x4')](_0x203e5a[_0x3d399e('0x11')],_0x18d2c9[_0x3d399e('0x13')]),_0x3eb9e3);_0x203e5a[_0x3d399e('0x11')][_0x3d399e('0x1e')]&&(_0x3e6ce7[_0x3d399e('0x25')]=_['merge'](_0x3e6ce7[_0x3d399e('0x25')],{[Op['or']]:_[_0x3d399e('0xd')](_0x3eb9e3,function(_0x13be96){const _0x358d8f=_0x3d399e;if(_0x13be96[_0x358d8f('0x3')]!==_0x358d8f('0x29')){const _0xd9f6c1={};return _0xd9f6c1[_0x13be96[_0x358d8f('0x9')]]={[Op['like']]:'%'+_0x203e5a[_0x358d8f('0x11')][_0x358d8f('0x1e')]+'%'},_0xd9f6c1;}})}));_0x3e6ce7=_[_0x3d399e('0x7')]({},_0x3e6ce7,_0x203e5a[_0x3d399e('0x2f')]);const _0x5d8406={'where':_0x3e6ce7[_0x3d399e('0x25')]};return db[_0x3d399e('0x2d')][_0x3d399e('0x10')](_0x5d8406)[_0x3d399e('0x20')](function(_0x54ca44){const _0x3e126b=_0x3d399e;return _0x16dbc0[_0x3e126b('0x10')]=_0x54ca44,_0x203e5a[_0x3e126b('0x11')]['includeAll']&&(_0x3e6ce7['include']=[{'all':!![]}]),db[_0x3e126b('0x2d')][_0x3e126b('0x17')](_0x3e6ce7);})[_0x3d399e('0x20')](function(_0x32edfd){return _0x16dbc0['rows']=_0x32edfd,_0x16dbc0;})[_0x3d399e('0x20')](respondWithFilteredResult(_0x5bbc1c,_0x3e6ce7))[_0x3d399e('0x14')](handleError(_0x5bbc1c,null));},exports[_0xd40b0('0x1d')]=function(_0x39ab35,_0x57bd29){const _0x4ac74c=_0xd40b0;let _0x4f56d0={'raw':!![],'where':{'id':_0x39ab35[_0x4ac74c('0x2')]['id']}};const _0x1fd637={};return _0x1fd637[_0x4ac74c('0xb')]=_[_0x4ac74c('0x16')](db[_0x4ac74c('0x2d')][_0x4ac74c('0x2b')]),_0x1fd637[_0x4ac74c('0x11')]=_['keys'](_0x39ab35[_0x4ac74c('0x11')]),_0x1fd637[_0x4ac74c('0x13')]=_[_0x4ac74c('0x1f')](_0x1fd637[_0x4ac74c('0xb')],_0x1fd637[_0x4ac74c('0x11')]),_0x4f56d0[_0x4ac74c('0x23')]=_[_0x4ac74c('0x1f')](_0x1fd637['model'],qs[_0x4ac74c('0x12')](_0x39ab35[_0x4ac74c('0x11')][_0x4ac74c('0x12')])),_0x4f56d0[_0x4ac74c('0x23')]=_0x4f56d0['attributes']['length']?_0x4f56d0[_0x4ac74c('0x23')]:_0x1fd637[_0x4ac74c('0xb')],_0x39ab35[_0x4ac74c('0x11')][_0x4ac74c('0x6')]&&(_0x4f56d0[_0x4ac74c('0x21')]=[{'all':!![]}]),_0x4f56d0=_[_0x4ac74c('0x7')]({},_0x4f56d0,_0x39ab35[_0x4ac74c('0x2f')]),db[_0x4ac74c('0x2d')]['findOne'](_0x4f56d0)['then'](handleEntityNotFound(_0x57bd29,null))[_0x4ac74c('0x20')](respondWithResult(_0x57bd29,null))[_0x4ac74c('0x14')](handleError(_0x57bd29,null));},exports['create']=function(_0x415e45,_0x52e4ec){const _0x1db50a=_0xd40b0;return db['SmsTransferReport'][_0x1db50a('0xa')](_0x415e45[_0x1db50a('0x26')],{})[_0x1db50a('0x20')](respondWithResult(_0x52e4ec,0xc9))[_0x1db50a('0x14')](handleError(_0x52e4ec,null));},exports[_0xd40b0('0x31')]=function(_0x4ed0b6,_0x514af3){const _0x106a63=_0xd40b0;return _0x4ed0b6['body']['id']&&delete _0x4ed0b6[_0x106a63('0x26')]['id'],db[_0x106a63('0x2d')][_0x106a63('0x2c')]({'where':{'id':_0x4ed0b6[_0x106a63('0x2')]['id']}})[_0x106a63('0x20')](handleEntityNotFound(_0x514af3,null))['then'](saveUpdates(_0x4ed0b6[_0x106a63('0x26')],null))['then'](respondWithResult(_0x514af3,null))[_0x106a63('0x14')](handleError(_0x514af3,null));},exports[_0xd40b0('0x24')]=function(_0xaf0abc,_0x2ab14b){const _0x82903d=_0xd40b0;return db[_0x82903d('0x2d')][_0x82903d('0x2c')]({'where':{'id':_0xaf0abc[_0x82903d('0x2')]['id']}})[_0x82903d('0x20')](handleEntityNotFound(_0x2ab14b,null))[_0x82903d('0x20')](removeEntity(_0x2ab14b,null))[_0x82903d('0x14')](handleError(_0x2ab14b,null));},exports[_0xd40b0('0xf')]=function(_0x724520,_0xf563ba){const _0x255daf=_0xd40b0;return db['SmsTransferReport'][_0x255daf('0xf')]()['then'](respondWithResult(_0xf563ba,null))['catch'](handleError(_0xf563ba,null));};