Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / smsTransferReport / smsTransferReport.controller.js
index 940c995..3d972ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06b8=['squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','apply','update','destroy','then','error','map','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','SmsTransferReport','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x3720c7,_0x1d660c){var _0x2c50a8=function(_0x53c51e){while(--_0x53c51e){_0x3720c7['push'](_0x3720c7['shift']());}};_0x2c50a8(++_0x1d660c);}(_0x06b8,0x19f));var _0x806b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x06b8[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x806b('0x0'));var rimraf=require(_0x806b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x806b('0x2'));var moment=require(_0x806b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x806b('0x4'));var util=require(_0x806b('0x5'));var path=require(_0x806b('0x6'));var sox=require(_0x806b('0x7'));var csv=require('to-csv');var ejs=require(_0x806b('0x8'));var fs=require('fs');var fs_extra=require(_0x806b('0x9'));var _=require(_0x806b('0xa'));var squel=require(_0x806b('0xb'));var crypto=require('crypto');var jsforce=require(_0x806b('0xc'));var deskjs=require(_0x806b('0xd'));var toCsv=require(_0x806b('0xe'));var querystring=require('querystring');var Papa=require(_0x806b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x806b('0x10'));var hardwareService=require(_0x806b('0x11'));var logger=require(_0x806b('0x12'))(_0x806b('0x13'));var utils=require(_0x806b('0x14'));var config=require(_0x806b('0x15'));var licenseUtil=require(_0x806b('0x16'));var db=require(_0x806b('0x17'))['db'];function respondWithStatusCode(_0xd8076e,_0x5d4e01){_0x5d4e01=_0x5d4e01||0xcc;return function(_0xb47c7e){if(_0xb47c7e){return _0xd8076e[_0x806b('0x18')](_0x5d4e01);}return _0xd8076e[_0x806b('0x19')](_0x5d4e01)[_0x806b('0x1a')]();};}function respondWithResult(_0x2ee2af,_0x5918fc){_0x5918fc=_0x5918fc||0xc8;return function(_0x8a6f14){if(_0x8a6f14){return _0x2ee2af[_0x806b('0x19')](_0x5918fc)[_0x806b('0x1b')](_0x8a6f14);}};}function respondWithFilteredResult(_0x220503,_0x4369a4){return function(_0x161956){if(_0x161956){var _0x205282=typeof _0x4369a4['offset']===_0x806b('0x1c')&&typeof _0x4369a4[_0x806b('0x1d')]===_0x806b('0x1c');var _0x1108cd=_0x161956['count'];var _0x3874cc=_0x205282?0x0:_0x4369a4[_0x806b('0x1e')];var _0x6f886e=_0x205282?_0x161956['count']:_0x4369a4[_0x806b('0x1e')]+_0x4369a4['limit'];var _0x12cb6b;if(_0x6f886e>=_0x1108cd){_0x6f886e=_0x1108cd;_0x12cb6b=0xc8;}else{_0x12cb6b=0xce;}_0x220503[_0x806b('0x19')](_0x12cb6b);return _0x220503['set']('Content-Range',_0x3874cc+'-'+_0x6f886e+'/'+_0x1108cd)[_0x806b('0x1b')](_0x161956);}return null;};}function patchUpdates(_0x50be98){return function(_0xb8f479){try{jsonpatch[_0x806b('0x1f')](_0xb8f479,_0x50be98,!![]);}catch(_0x1cb262){return BPromise['reject'](_0x1cb262);}return _0xb8f479['save']();};}function saveUpdates(_0x402a08,_0x2dda88){return function(_0xd2654a){if(_0xd2654a){return _0xd2654a[_0x806b('0x20')](_0x402a08)['then'](function(_0xdb9257){return _0xdb9257;});}return null;};}function removeEntity(_0xddb0e2,_0x3df5cc){return function(_0x902ec8){if(_0x902ec8){return _0x902ec8[_0x806b('0x21')]()[_0x806b('0x22')](function(){_0xddb0e2['status'](0xcc)[_0x806b('0x1a')]();});}};}function handleEntityNotFound(_0x4d77d0,_0x105538){return function(_0x1143d6){if(!_0x1143d6){_0x4d77d0[_0x806b('0x18')](0x194);}return _0x1143d6;};}function handleError(_0x372cbc,_0x59f894){_0x59f894=_0x59f894||0x1f4;return function(_0x52001e){logger[_0x806b('0x23')](_0x52001e['stack']);if(_0x52001e['name']){delete _0x52001e['name'];}_0x372cbc['status'](_0x59f894)['send'](_0x52001e);};}exports['index']=function(_0xa84f93,_0x8a85ca){var _0x21f60f={},_0x493bfb={},_0x18b075={'count':0x0,'rows':[]};var _0x5807ed=_[_0x806b('0x24')](db['SmsTransferReport']['rawAttributes'],function(_0x5f00f7){return{'name':_0x5f00f7[_0x806b('0x25')],'type':_0x5f00f7['type'][_0x806b('0x26')]};});_0x493bfb[_0x806b('0x27')]=_[_0x806b('0x24')](_0x5807ed,_0x806b('0x28'));_0x493bfb[_0x806b('0x29')]=_[_0x806b('0x2a')](_0xa84f93[_0x806b('0x29')]);_0x493bfb[_0x806b('0x2b')]=_[_0x806b('0x2c')](_0x493bfb[_0x806b('0x27')],_0x493bfb[_0x806b('0x29')]);_0x21f60f[_0x806b('0x2d')]=_[_0x806b('0x2c')](_0x493bfb[_0x806b('0x27')],qs[_0x806b('0x2e')](_0xa84f93[_0x806b('0x29')]['fields']));_0x21f60f[_0x806b('0x2d')]=_0x21f60f[_0x806b('0x2d')][_0x806b('0x2f')]?_0x21f60f[_0x806b('0x2d')]:_0x493bfb[_0x806b('0x27')];if(!_0xa84f93[_0x806b('0x29')][_0x806b('0x30')]('nolimit')){_0x21f60f['limit']=qs[_0x806b('0x1d')](_0xa84f93[_0x806b('0x29')][_0x806b('0x1d')]);_0x21f60f[_0x806b('0x1e')]=qs[_0x806b('0x1e')](_0xa84f93[_0x806b('0x29')][_0x806b('0x1e')]);}_0x21f60f[_0x806b('0x31')]=qs['sort'](_0xa84f93[_0x806b('0x29')][_0x806b('0x32')]);_0x21f60f[_0x806b('0x33')]=qs[_0x806b('0x2b')](_[_0x806b('0x34')](_0xa84f93[_0x806b('0x29')],_0x493bfb[_0x806b('0x2b')]),_0x5807ed);if(_0xa84f93['query'][_0x806b('0x35')]){_0x21f60f[_0x806b('0x33')]=_[_0x806b('0x36')](_0x21f60f[_0x806b('0x33')],{'$or':_[_0x806b('0x24')](_0x5807ed,function(_0x495a70){if(_0x495a70[_0x806b('0x37')]!==_0x806b('0x38')){var _0x5b7e30={};_0x5b7e30[_0x495a70[_0x806b('0x28')]]={'$like':'%'+_0xa84f93[_0x806b('0x29')][_0x806b('0x35')]+'%'};return _0x5b7e30;}})});}_0x21f60f=_[_0x806b('0x36')]({},_0x21f60f,_0xa84f93[_0x806b('0x39')]);var _0x3a1566={'where':_0x21f60f['where']};return db['SmsTransferReport'][_0x806b('0x3a')](_0x3a1566)[_0x806b('0x22')](function(_0x363b58){_0x18b075['count']=_0x363b58;if(_0xa84f93[_0x806b('0x29')][_0x806b('0x3b')]){_0x21f60f[_0x806b('0x3c')]=[{'all':!![]}];}return db[_0x806b('0x3d')]['findAll'](_0x21f60f);})[_0x806b('0x22')](function(_0x33e59f){_0x18b075[_0x806b('0x3e')]=_0x33e59f;return _0x18b075;})['then'](respondWithFilteredResult(_0x8a85ca,_0x21f60f))[_0x806b('0x3f')](handleError(_0x8a85ca,null));};exports[_0x806b('0x40')]=function(_0x1fd5df,_0x2e3236){var _0x2889b6={'raw':!![],'where':{'id':_0x1fd5df[_0x806b('0x41')]['id']}},_0x1b7b98={};_0x1b7b98['model']=_[_0x806b('0x2a')](db['SmsTransferReport'][_0x806b('0x42')]);_0x1b7b98['query']=_['keys'](_0x1fd5df['query']);_0x1b7b98[_0x806b('0x2b')]=_[_0x806b('0x2c')](_0x1b7b98[_0x806b('0x27')],_0x1b7b98[_0x806b('0x29')]);_0x2889b6[_0x806b('0x2d')]=_['intersection'](_0x1b7b98[_0x806b('0x27')],qs[_0x806b('0x2e')](_0x1fd5df[_0x806b('0x29')][_0x806b('0x2e')]));_0x2889b6['attributes']=_0x2889b6[_0x806b('0x2d')][_0x806b('0x2f')]?_0x2889b6[_0x806b('0x2d')]:_0x1b7b98[_0x806b('0x27')];if(_0x1fd5df['query'][_0x806b('0x3b')]){_0x2889b6[_0x806b('0x3c')]=[{'all':!![]}];}_0x2889b6=_[_0x806b('0x36')]({},_0x2889b6,_0x1fd5df[_0x806b('0x39')]);return db['SmsTransferReport'][_0x806b('0x43')](_0x2889b6)[_0x806b('0x22')](handleEntityNotFound(_0x2e3236,null))[_0x806b('0x22')](respondWithResult(_0x2e3236,null))['catch'](handleError(_0x2e3236,null));};exports[_0x806b('0x44')]=function(_0x1c2824,_0x41a989){return db['SmsTransferReport'][_0x806b('0x44')](_0x1c2824[_0x806b('0x45')],{})['then'](respondWithResult(_0x41a989,0xc9))[_0x806b('0x3f')](handleError(_0x41a989,null));};exports[_0x806b('0x20')]=function(_0x491a56,_0xcd059d){if(_0x491a56[_0x806b('0x45')]['id']){delete _0x491a56[_0x806b('0x45')]['id'];}return db['SmsTransferReport'][_0x806b('0x43')]({'where':{'id':_0x491a56[_0x806b('0x41')]['id']}})['then'](handleEntityNotFound(_0xcd059d,null))[_0x806b('0x22')](saveUpdates(_0x491a56[_0x806b('0x45')],null))[_0x806b('0x22')](respondWithResult(_0xcd059d,null))[_0x806b('0x3f')](handleError(_0xcd059d,null));};exports['destroy']=function(_0x58e4d9,_0x319732){return db[_0x806b('0x3d')][_0x806b('0x43')]({'where':{'id':_0x58e4d9[_0x806b('0x41')]['id']}})[_0x806b('0x22')](handleEntityNotFound(_0x319732,null))[_0x806b('0x22')](removeEntity(_0x319732,null))['catch'](handleError(_0x319732,null));};exports[_0x806b('0x46')]=function(_0x368036,_0x549d7a){return db[_0x806b('0x3d')]['describe']()['then'](respondWithResult(_0x549d7a,null))[_0x806b('0x3f')](handleError(_0x549d7a,null));};
\ No newline at end of file
+var _0x30f3=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','filter','options','then','SmsTransferReport','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x2d53ce,_0x33c348){var _0x322a86=function(_0x40b2a5){while(--_0x40b2a5){_0x2d53ce['push'](_0x2d53ce['shift']());}};_0x322a86(++_0x33c348);}(_0x30f3,0x1e0));var _0x330f=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0x30f3[_0x3cafb8];return _0x4b7f85;};'use strict';var emlformat=require(_0x330f('0x0'));var rimraf=require(_0x330f('0x1'));var zipdir=require(_0x330f('0x2'));var jsonpatch=require(_0x330f('0x3'));var rp=require('request-promise');var moment=require(_0x330f('0x4'));var BPromise=require(_0x330f('0x5'));var Mustache=require(_0x330f('0x6'));var util=require(_0x330f('0x7'));var path=require('path');var sox=require(_0x330f('0x8'));var csv=require(_0x330f('0x9'));var ejs=require(_0x330f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x330f('0xb'));var squel=require(_0x330f('0xc'));var crypto=require(_0x330f('0xd'));var jsforce=require(_0x330f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x330f('0x9'));var querystring=require(_0x330f('0xf'));var Papa=require(_0x330f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x330f('0x11'));var hardwareService=require(_0x330f('0x12'));var logger=require(_0x330f('0x13'))(_0x330f('0x14'));var utils=require(_0x330f('0x15'));var config=require(_0x330f('0x16'));var licenseUtil=require(_0x330f('0x17'));var db=require(_0x330f('0x18'))['db'];function respondWithStatusCode(_0x9717ed,_0x476f13){_0x476f13=_0x476f13||0xcc;return function(_0x14bfb8){if(_0x14bfb8){return _0x9717ed[_0x330f('0x19')](_0x476f13);}return _0x9717ed[_0x330f('0x1a')](_0x476f13)['end']();};}function respondWithResult(_0x42d615,_0x5461c0){_0x5461c0=_0x5461c0||0xc8;return function(_0x4756be){if(_0x4756be){return _0x42d615[_0x330f('0x1a')](_0x5461c0)['json'](_0x4756be);}};}function respondWithFilteredResult(_0x45d252,_0x193f86){return function(_0xfc4e4b){if(_0xfc4e4b){var _0x42e080=typeof _0x193f86[_0x330f('0x1b')]==='undefined'&&typeof _0x193f86[_0x330f('0x1c')]===_0x330f('0x1d');var _0x2136fd=_0xfc4e4b[_0x330f('0x1e')];var _0x44a8bf=_0x42e080?0x0:_0x193f86['offset'];var _0x7281dc=_0x42e080?_0xfc4e4b[_0x330f('0x1e')]:_0x193f86[_0x330f('0x1b')]+_0x193f86['limit'];var _0x1d7995;if(_0x7281dc>=_0x2136fd){_0x7281dc=_0x2136fd;_0x1d7995=0xc8;}else{_0x1d7995=0xce;}_0x45d252['status'](_0x1d7995);return _0x45d252[_0x330f('0x1f')](_0x330f('0x20'),_0x44a8bf+'-'+_0x7281dc+'/'+_0x2136fd)['json'](_0xfc4e4b);}return null;};}function patchUpdates(_0x1182b5){return function(_0x42c4c8){try{jsonpatch[_0x330f('0x21')](_0x42c4c8,_0x1182b5,!![]);}catch(_0x9d669a){return BPromise[_0x330f('0x22')](_0x9d669a);}return _0x42c4c8[_0x330f('0x23')]();};}function saveUpdates(_0x60595,_0x143856){return function(_0x5e907e){if(_0x5e907e){return _0x5e907e['update'](_0x60595)['then'](function(_0x4714c1){return _0x4714c1;});}return null;};}function removeEntity(_0xfc3d65,_0x3a147f){return function(_0x541d96){if(_0x541d96){return _0x541d96[_0x330f('0x24')]()['then'](function(){_0xfc3d65[_0x330f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1b45,_0x3257fc){return function(_0x25f67f){if(!_0x25f67f){_0x1f1b45[_0x330f('0x19')](0x194);}return _0x25f67f;};}function handleError(_0x59d082,_0x216be8){_0x216be8=_0x216be8||0x1f4;return function(_0x1e1e24){logger[_0x330f('0x25')](_0x1e1e24[_0x330f('0x26')]);if(_0x1e1e24[_0x330f('0x27')]){delete _0x1e1e24[_0x330f('0x27')];}_0x59d082[_0x330f('0x1a')](_0x216be8)[_0x330f('0x28')](_0x1e1e24);};}exports[_0x330f('0x29')]=function(_0x164ba1,_0x134205){var _0xb474e8={},_0x17944f={},_0x59db4a={'count':0x0,'rows':[]};var _0x42183c=_[_0x330f('0x2a')](db['SmsTransferReport'][_0x330f('0x2b')],function(_0x2126c3){return{'name':_0x2126c3['fieldName'],'type':_0x2126c3[_0x330f('0x2c')][_0x330f('0x2d')]};});_0x17944f[_0x330f('0x2e')]=_['map'](_0x42183c,_0x330f('0x27'));_0x17944f['query']=_[_0x330f('0x2f')](_0x164ba1[_0x330f('0x30')]);_0x17944f[_0x330f('0x31')]=_[_0x330f('0x32')](_0x17944f[_0x330f('0x2e')],_0x17944f[_0x330f('0x30')]);_0xb474e8[_0x330f('0x33')]=_[_0x330f('0x32')](_0x17944f[_0x330f('0x2e')],qs[_0x330f('0x34')](_0x164ba1['query'][_0x330f('0x34')]));_0xb474e8[_0x330f('0x33')]=_0xb474e8[_0x330f('0x33')][_0x330f('0x35')]?_0xb474e8['attributes']:_0x17944f[_0x330f('0x2e')];if(!_0x164ba1[_0x330f('0x30')][_0x330f('0x36')]('nolimit')){_0xb474e8[_0x330f('0x1c')]=qs[_0x330f('0x1c')](_0x164ba1[_0x330f('0x30')][_0x330f('0x1c')]);_0xb474e8[_0x330f('0x1b')]=qs[_0x330f('0x1b')](_0x164ba1[_0x330f('0x30')][_0x330f('0x1b')]);}_0xb474e8[_0x330f('0x37')]=qs[_0x330f('0x38')](_0x164ba1['query']['sort']);_0xb474e8['where']=qs[_0x330f('0x31')](_['pick'](_0x164ba1[_0x330f('0x30')],_0x17944f[_0x330f('0x31')]),_0x42183c);if(_0x164ba1[_0x330f('0x30')]['filter']){_0xb474e8['where']=_[_0x330f('0x39')](_0xb474e8[_0x330f('0x3a')],{'$or':_[_0x330f('0x2a')](_0x42183c,function(_0x4fc6e3){if(_0x4fc6e3['type']!==_0x330f('0x3b')){var _0xfac51f={};_0xfac51f[_0x4fc6e3[_0x330f('0x27')]]={'$like':'%'+_0x164ba1[_0x330f('0x30')][_0x330f('0x3c')]+'%'};return _0xfac51f;}})});}_0xb474e8=_['merge']({},_0xb474e8,_0x164ba1[_0x330f('0x3d')]);var _0x2e63c6={'where':_0xb474e8['where']};return db['SmsTransferReport'][_0x330f('0x1e')](_0x2e63c6)[_0x330f('0x3e')](function(_0x2a2b0a){_0x59db4a[_0x330f('0x1e')]=_0x2a2b0a;if(_0x164ba1[_0x330f('0x30')]['includeAll']){_0xb474e8['include']=[{'all':!![]}];}return db[_0x330f('0x3f')][_0x330f('0x40')](_0xb474e8);})['then'](function(_0x52a8f0){_0x59db4a[_0x330f('0x41')]=_0x52a8f0;return _0x59db4a;})[_0x330f('0x3e')](respondWithFilteredResult(_0x134205,_0xb474e8))[_0x330f('0x42')](handleError(_0x134205,null));};exports[_0x330f('0x43')]=function(_0x15bbfe,_0x2bacb3){var _0x337fff={'raw':!![],'where':{'id':_0x15bbfe[_0x330f('0x44')]['id']}},_0x56e277={};_0x56e277[_0x330f('0x2e')]=_[_0x330f('0x2f')](db[_0x330f('0x3f')][_0x330f('0x2b')]);_0x56e277['query']=_[_0x330f('0x2f')](_0x15bbfe[_0x330f('0x30')]);_0x56e277[_0x330f('0x31')]=_[_0x330f('0x32')](_0x56e277['model'],_0x56e277['query']);_0x337fff[_0x330f('0x33')]=_[_0x330f('0x32')](_0x56e277['model'],qs[_0x330f('0x34')](_0x15bbfe[_0x330f('0x30')][_0x330f('0x34')]));_0x337fff['attributes']=_0x337fff['attributes'][_0x330f('0x35')]?_0x337fff[_0x330f('0x33')]:_0x56e277[_0x330f('0x2e')];if(_0x15bbfe[_0x330f('0x30')]['includeAll']){_0x337fff[_0x330f('0x45')]=[{'all':!![]}];}_0x337fff=_['merge']({},_0x337fff,_0x15bbfe['options']);return db['SmsTransferReport'][_0x330f('0x46')](_0x337fff)[_0x330f('0x3e')](handleEntityNotFound(_0x2bacb3,null))[_0x330f('0x3e')](respondWithResult(_0x2bacb3,null))['catch'](handleError(_0x2bacb3,null));};exports[_0x330f('0x47')]=function(_0x4ced47,_0x2921b2){return db[_0x330f('0x3f')][_0x330f('0x47')](_0x4ced47[_0x330f('0x48')],{})[_0x330f('0x3e')](respondWithResult(_0x2921b2,0xc9))[_0x330f('0x42')](handleError(_0x2921b2,null));};exports[_0x330f('0x49')]=function(_0x4c29e6,_0x148327){if(_0x4c29e6[_0x330f('0x48')]['id']){delete _0x4c29e6[_0x330f('0x48')]['id'];}return db[_0x330f('0x3f')][_0x330f('0x46')]({'where':{'id':_0x4c29e6[_0x330f('0x44')]['id']}})[_0x330f('0x3e')](handleEntityNotFound(_0x148327,null))[_0x330f('0x3e')](saveUpdates(_0x4c29e6['body'],null))[_0x330f('0x3e')](respondWithResult(_0x148327,null))['catch'](handleError(_0x148327,null));};exports['destroy']=function(_0xe2d07b,_0x3e0741){return db['SmsTransferReport']['find']({'where':{'id':_0xe2d07b[_0x330f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e0741,null))[_0x330f('0x3e')](removeEntity(_0x3e0741,null))[_0x330f('0x42')](handleError(_0x3e0741,null));};exports[_0x330f('0x4a')]=function(_0x28c290,_0x216b84){return db[_0x330f('0x3f')][_0x330f('0x4a')]()[_0x330f('0x3e')](respondWithResult(_0x216b84,null))[_0x330f('0x42')](handleError(_0x216b84,null));};
\ No newline at end of file