Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / smsApplication / smsApplication.controller.js
index 80336f9..820ad17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9382=['sort','where','filters','filter','includeAll','include','catch','show','params','merge','options','find','create','body','update','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x4a0a69,_0x44385b){var _0x26b78f=function(_0x341c95){while(--_0x341c95){_0x4a0a69['push'](_0x4a0a69['shift']());}};_0x26b78f(++_0x44385b);}(_0x9382,0xa1));var _0x2938=function(_0x24bf42,_0x4c6112){_0x24bf42=_0x24bf42-0x0;var _0x971c74=_0x9382[_0x24bf42];return _0x971c74;};'use strict';var emlformat=require(_0x2938('0x0'));var rimraf=require(_0x2938('0x1'));var zipdir=require(_0x2938('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2938('0x3'));var Mustache=require(_0x2938('0x4'));var util=require(_0x2938('0x5'));var path=require('path');var sox=require(_0x2938('0x6'));var csv=require(_0x2938('0x7'));var ejs=require(_0x2938('0x8'));var fs=require('fs');var fs_extra=require(_0x2938('0x9'));var _=require(_0x2938('0xa'));var squel=require('squel');var crypto=require(_0x2938('0xb'));var jsforce=require(_0x2938('0xc'));var deskjs=require(_0x2938('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2938('0xe'));var Papa=require(_0x2938('0xf'));var Redis=require('ioredis');var authService=require(_0x2938('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2938('0x11'));var hardwareService=require(_0x2938('0x12'));var logger=require(_0x2938('0x13'))(_0x2938('0x14'));var utils=require(_0x2938('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2938('0x16'));var db=require(_0x2938('0x17'))['db'];function respondWithStatusCode(_0x23eba8,_0x2f7a5a){_0x2f7a5a=_0x2f7a5a||0xcc;return function(_0x13e1b3){if(_0x13e1b3){return _0x23eba8[_0x2938('0x18')](_0x2f7a5a);}return _0x23eba8['status'](_0x2f7a5a)[_0x2938('0x19')]();};}function respondWithResult(_0x564536,_0x593c9c){_0x593c9c=_0x593c9c||0xc8;return function(_0xd62f27){if(_0xd62f27){return _0x564536['status'](_0x593c9c)[_0x2938('0x1a')](_0xd62f27);}};}function respondWithFilteredResult(_0x5b3a7b,_0x17edcd){return function(_0x3b6602){if(_0x3b6602){var _0x2d3801=typeof _0x17edcd['offset']===_0x2938('0x1b')&&typeof _0x17edcd[_0x2938('0x1c')]==='undefined';var _0xcecf42=_0x3b6602[_0x2938('0x1d')];var _0x10be66=_0x2d3801?0x0:_0x17edcd[_0x2938('0x1e')];var _0x4c7cbb=_0x2d3801?_0x3b6602['count']:_0x17edcd[_0x2938('0x1e')]+_0x17edcd[_0x2938('0x1c')];var _0x5087b1;if(_0x4c7cbb>=_0xcecf42){_0x4c7cbb=_0xcecf42;_0x5087b1=0xc8;}else{_0x5087b1=0xce;}_0x5b3a7b[_0x2938('0x1f')](_0x5087b1);return _0x5b3a7b[_0x2938('0x20')]('Content-Range',_0x10be66+'-'+_0x4c7cbb+'/'+_0xcecf42)[_0x2938('0x1a')](_0x3b6602);}return null;};}function patchUpdates(_0x268439){return function(_0x5e2212){try{jsonpatch[_0x2938('0x21')](_0x5e2212,_0x268439,!![]);}catch(_0x288108){return BPromise[_0x2938('0x22')](_0x288108);}return _0x5e2212[_0x2938('0x23')]();};}function saveUpdates(_0x4a4ea4,_0x3c9b5c){return function(_0x95e582){if(_0x95e582){return _0x95e582['update'](_0x4a4ea4)[_0x2938('0x24')](function(_0x3a6a77){return _0x3a6a77;});}return null;};}function removeEntity(_0x5858d3,_0x36ef73){return function(_0x26196c){if(_0x26196c){return _0x26196c[_0x2938('0x25')]()['then'](function(){_0x5858d3[_0x2938('0x1f')](0xcc)[_0x2938('0x19')]();});}};}function handleEntityNotFound(_0x16f005,_0x2667bc){return function(_0xf5a5e8){if(!_0xf5a5e8){_0x16f005[_0x2938('0x18')](0x194);}return _0xf5a5e8;};}function handleError(_0x56b739,_0x124c1a){_0x124c1a=_0x124c1a||0x1f4;return function(_0x2d6d67){logger[_0x2938('0x26')](_0x2d6d67[_0x2938('0x27')]);if(_0x2d6d67[_0x2938('0x28')]){delete _0x2d6d67['name'];}_0x56b739[_0x2938('0x1f')](_0x124c1a)[_0x2938('0x29')](_0x2d6d67);};}exports[_0x2938('0x2a')]=function(_0x4fda68,_0x222dc2){var _0xc1692b={},_0x516d21={},_0x21473d={'count':0x0,'rows':[]};var _0x3f2c09=_[_0x2938('0x2b')](db[_0x2938('0x2c')][_0x2938('0x2d')],function(_0x2dc66c){return{'name':_0x2dc66c[_0x2938('0x2e')],'type':_0x2dc66c[_0x2938('0x2f')][_0x2938('0x30')]};});_0x516d21[_0x2938('0x31')]=_[_0x2938('0x2b')](_0x3f2c09,_0x2938('0x28'));_0x516d21['query']=_[_0x2938('0x32')](_0x4fda68[_0x2938('0x33')]);_0x516d21['filters']=_['intersection'](_0x516d21['model'],_0x516d21[_0x2938('0x33')]);_0xc1692b[_0x2938('0x34')]=_[_0x2938('0x35')](_0x516d21[_0x2938('0x31')],qs[_0x2938('0x36')](_0x4fda68['query'][_0x2938('0x36')]));_0xc1692b[_0x2938('0x34')]=_0xc1692b[_0x2938('0x34')][_0x2938('0x37')]?_0xc1692b[_0x2938('0x34')]:_0x516d21[_0x2938('0x31')];if(!_0x4fda68[_0x2938('0x33')][_0x2938('0x38')](_0x2938('0x39'))){_0xc1692b['limit']=qs[_0x2938('0x1c')](_0x4fda68[_0x2938('0x33')]['limit']);_0xc1692b[_0x2938('0x1e')]=qs[_0x2938('0x1e')](_0x4fda68[_0x2938('0x33')][_0x2938('0x1e')]);}_0xc1692b['order']=qs[_0x2938('0x3a')](_0x4fda68[_0x2938('0x33')]['sort']);_0xc1692b[_0x2938('0x3b')]=qs[_0x2938('0x3c')](_['pick'](_0x4fda68['query'],_0x516d21['filters']),_0x3f2c09);if(_0x4fda68[_0x2938('0x33')][_0x2938('0x3d')]){_0xc1692b['where']=_['merge'](_0xc1692b[_0x2938('0x3b')],{'$or':_[_0x2938('0x2b')](_0x3f2c09,function(_0x57bed7){if(_0x57bed7['type']!=='VIRTUAL'){var _0x337320={};_0x337320[_0x57bed7[_0x2938('0x28')]]={'$like':'%'+_0x4fda68[_0x2938('0x33')]['filter']+'%'};return _0x337320;}})});}_0xc1692b=_['merge']({},_0xc1692b,_0x4fda68['options']);var _0xd7d8bf={'where':_0xc1692b[_0x2938('0x3b')]};return db['SmsApplication'][_0x2938('0x1d')](_0xd7d8bf)[_0x2938('0x24')](function(_0x33d57e){_0x21473d[_0x2938('0x1d')]=_0x33d57e;if(_0x4fda68[_0x2938('0x33')][_0x2938('0x3e')]){_0xc1692b[_0x2938('0x3f')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0xc1692b);})['then'](function(_0x36a945){_0x21473d['rows']=_0x36a945;return _0x21473d;})[_0x2938('0x24')](respondWithFilteredResult(_0x222dc2,_0xc1692b))[_0x2938('0x40')](handleError(_0x222dc2,null));};exports[_0x2938('0x41')]=function(_0x511b64,_0x5601bf){var _0x1e334c={'raw':!![],'where':{'id':_0x511b64[_0x2938('0x42')]['id']}},_0x2dd853={};_0x2dd853[_0x2938('0x31')]=_[_0x2938('0x32')](db['SmsApplication']['rawAttributes']);_0x2dd853[_0x2938('0x33')]=_['keys'](_0x511b64[_0x2938('0x33')]);_0x2dd853[_0x2938('0x3c')]=_['intersection'](_0x2dd853[_0x2938('0x31')],_0x2dd853[_0x2938('0x33')]);_0x1e334c[_0x2938('0x34')]=_[_0x2938('0x35')](_0x2dd853['model'],qs['fields'](_0x511b64['query'][_0x2938('0x36')]));_0x1e334c['attributes']=_0x1e334c[_0x2938('0x34')][_0x2938('0x37')]?_0x1e334c[_0x2938('0x34')]:_0x2dd853[_0x2938('0x31')];if(_0x511b64[_0x2938('0x33')][_0x2938('0x3e')]){_0x1e334c[_0x2938('0x3f')]=[{'all':!![]}];}_0x1e334c=_[_0x2938('0x43')]({},_0x1e334c,_0x511b64[_0x2938('0x44')]);return db[_0x2938('0x2c')][_0x2938('0x45')](_0x1e334c)[_0x2938('0x24')](handleEntityNotFound(_0x5601bf,null))[_0x2938('0x24')](respondWithResult(_0x5601bf,null))[_0x2938('0x40')](handleError(_0x5601bf,null));};exports[_0x2938('0x46')]=function(_0x1ad05b,_0x196803){return db[_0x2938('0x2c')][_0x2938('0x46')](_0x1ad05b[_0x2938('0x47')],{})[_0x2938('0x24')](respondWithResult(_0x196803,0xc9))[_0x2938('0x40')](handleError(_0x196803,null));};exports[_0x2938('0x48')]=function(_0x2d000b,_0x26b397){if(_0x2d000b[_0x2938('0x47')]['id']){delete _0x2d000b[_0x2938('0x47')]['id'];}return db[_0x2938('0x2c')][_0x2938('0x45')]({'where':{'id':_0x2d000b[_0x2938('0x42')]['id']}})[_0x2938('0x24')](handleEntityNotFound(_0x26b397,null))['then'](saveUpdates(_0x2d000b[_0x2938('0x47')],null))[_0x2938('0x24')](respondWithResult(_0x26b397,null))[_0x2938('0x40')](handleError(_0x26b397,null));};exports[_0x2938('0x25')]=function(_0x28f02c,_0x3d5a7c){return db['SmsApplication']['find']({'where':{'id':_0x28f02c[_0x2938('0x42')]['id']}})[_0x2938('0x24')](handleEntityNotFound(_0x3d5a7c,null))['then'](removeEntity(_0x3d5a7c,null))[_0x2938('0x40')](handleError(_0x3d5a7c,null));};
\ No newline at end of file
+var _0x0234=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','catch','show','find','create','body','params'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0234,0x12c));var _0x4023=function(_0x3a8114,_0x549ce8){_0x3a8114=_0x3a8114-0x0;var _0x4ebb2f=_0x0234[_0x3a8114];return _0x4ebb2f;};'use strict';var emlformat=require(_0x4023('0x0'));var rimraf=require(_0x4023('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4023('0x2'));var rp=require(_0x4023('0x3'));var moment=require(_0x4023('0x4'));var BPromise=require(_0x4023('0x5'));var Mustache=require(_0x4023('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4023('0x7'));var csv=require(_0x4023('0x8'));var ejs=require(_0x4023('0x9'));var fs=require('fs');var fs_extra=require(_0x4023('0xa'));var _=require(_0x4023('0xb'));var squel=require('squel');var crypto=require(_0x4023('0xc'));var jsforce=require(_0x4023('0xd'));var deskjs=require(_0x4023('0xe'));var toCsv=require(_0x4023('0x8'));var querystring=require(_0x4023('0xf'));var Papa=require('papaparse');var Redis=require(_0x4023('0x10'));var authService=require(_0x4023('0x11'));var qs=require(_0x4023('0x12'));var as=require(_0x4023('0x13'));var hardwareService=require(_0x4023('0x14'));var logger=require(_0x4023('0x15'))(_0x4023('0x16'));var utils=require(_0x4023('0x17'));var config=require(_0x4023('0x18'));var licenseUtil=require(_0x4023('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ffbcb,_0x32b31b){_0x32b31b=_0x32b31b||0xcc;return function(_0x2548ac){if(_0x2548ac){return _0x1ffbcb['sendStatus'](_0x32b31b);}return _0x1ffbcb[_0x4023('0x1a')](_0x32b31b)[_0x4023('0x1b')]();};}function respondWithResult(_0x1a6113,_0x348edc){_0x348edc=_0x348edc||0xc8;return function(_0x4c0224){if(_0x4c0224){return _0x1a6113[_0x4023('0x1a')](_0x348edc)[_0x4023('0x1c')](_0x4c0224);}};}function respondWithFilteredResult(_0x167665,_0x47d475){return function(_0xd7198){if(_0xd7198){var _0x5ea480=typeof _0x47d475[_0x4023('0x1d')]===_0x4023('0x1e')&&typeof _0x47d475[_0x4023('0x1f')]===_0x4023('0x1e');var _0xc41d6d=_0xd7198[_0x4023('0x20')];var _0x1a6fd4=_0x5ea480?0x0:_0x47d475[_0x4023('0x1d')];var _0x9114a=_0x5ea480?_0xd7198[_0x4023('0x20')]:_0x47d475[_0x4023('0x1d')]+_0x47d475['limit'];var _0x2c3896;if(_0x9114a>=_0xc41d6d){_0x9114a=_0xc41d6d;_0x2c3896=0xc8;}else{_0x2c3896=0xce;}_0x167665['status'](_0x2c3896);return _0x167665['set'](_0x4023('0x21'),_0x1a6fd4+'-'+_0x9114a+'/'+_0xc41d6d)[_0x4023('0x1c')](_0xd7198);}return null;};}function patchUpdates(_0x50b861){return function(_0x53efa9){try{jsonpatch[_0x4023('0x22')](_0x53efa9,_0x50b861,!![]);}catch(_0x54b51){return BPromise[_0x4023('0x23')](_0x54b51);}return _0x53efa9['save']();};}function saveUpdates(_0x46a95d,_0x264edd){return function(_0x2c9391){if(_0x2c9391){return _0x2c9391[_0x4023('0x24')](_0x46a95d)['then'](function(_0x52388d){return _0x52388d;});}return null;};}function removeEntity(_0x46e0ae,_0x373d33){return function(_0x3abc9b){if(_0x3abc9b){return _0x3abc9b[_0x4023('0x25')]()[_0x4023('0x26')](function(){_0x46e0ae[_0x4023('0x1a')](0xcc)[_0x4023('0x1b')]();});}};}function handleEntityNotFound(_0x127c19,_0x45ca09){return function(_0x33f3c8){if(!_0x33f3c8){_0x127c19[_0x4023('0x27')](0x194);}return _0x33f3c8;};}function handleError(_0x506c78,_0x3529a9){_0x3529a9=_0x3529a9||0x1f4;return function(_0x22b339){logger[_0x4023('0x28')](_0x22b339[_0x4023('0x29')]);if(_0x22b339[_0x4023('0x2a')]){delete _0x22b339[_0x4023('0x2a')];}_0x506c78[_0x4023('0x1a')](_0x3529a9)[_0x4023('0x2b')](_0x22b339);};}exports[_0x4023('0x2c')]=function(_0x2cbb5c,_0xd3ae08){var _0x205010={},_0x2d6fb6={},_0x59a35f={'count':0x0,'rows':[]};var _0x5c3cfc=_['map'](db[_0x4023('0x2d')][_0x4023('0x2e')],function(_0x280ad5){return{'name':_0x280ad5[_0x4023('0x2f')],'type':_0x280ad5[_0x4023('0x30')][_0x4023('0x31')]};});_0x2d6fb6[_0x4023('0x32')]=_['map'](_0x5c3cfc,_0x4023('0x2a'));_0x2d6fb6[_0x4023('0x33')]=_[_0x4023('0x34')](_0x2cbb5c[_0x4023('0x33')]);_0x2d6fb6[_0x4023('0x35')]=_[_0x4023('0x36')](_0x2d6fb6['model'],_0x2d6fb6[_0x4023('0x33')]);_0x205010[_0x4023('0x37')]=_[_0x4023('0x36')](_0x2d6fb6['model'],qs[_0x4023('0x38')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x38')]));_0x205010[_0x4023('0x37')]=_0x205010[_0x4023('0x37')][_0x4023('0x39')]?_0x205010[_0x4023('0x37')]:_0x2d6fb6[_0x4023('0x32')];if(!_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3a')](_0x4023('0x3b'))){_0x205010[_0x4023('0x1f')]=qs['limit'](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x1f')]);_0x205010[_0x4023('0x1d')]=qs[_0x4023('0x1d')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x1d')]);}_0x205010[_0x4023('0x3c')]=qs[_0x4023('0x3d')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3d')]);_0x205010[_0x4023('0x3e')]=qs[_0x4023('0x35')](_['pick'](_0x2cbb5c[_0x4023('0x33')],_0x2d6fb6[_0x4023('0x35')]),_0x5c3cfc);if(_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3f')]){_0x205010[_0x4023('0x3e')]=_[_0x4023('0x40')](_0x205010['where'],{'$or':_[_0x4023('0x41')](_0x5c3cfc,function(_0x1c77d8){if(_0x1c77d8[_0x4023('0x30')]!==_0x4023('0x42')){var _0x4080c3={};_0x4080c3[_0x1c77d8['name']]={'$like':'%'+_0x2cbb5c[_0x4023('0x33')]['filter']+'%'};return _0x4080c3;}})});}_0x205010=_[_0x4023('0x40')]({},_0x205010,_0x2cbb5c['options']);var _0x57042d={'where':_0x205010['where']};return db[_0x4023('0x2d')][_0x4023('0x20')](_0x57042d)[_0x4023('0x26')](function(_0x3b7c39){_0x59a35f[_0x4023('0x20')]=_0x3b7c39;if(_0x2cbb5c[_0x4023('0x33')][_0x4023('0x43')]){_0x205010[_0x4023('0x44')]=[{'all':!![]}];}return db[_0x4023('0x2d')]['findAll'](_0x205010);})['then'](function(_0x43bc3d){_0x59a35f['rows']=_0x43bc3d;return _0x59a35f;})[_0x4023('0x26')](respondWithFilteredResult(_0xd3ae08,_0x205010))[_0x4023('0x45')](handleError(_0xd3ae08,null));};exports[_0x4023('0x46')]=function(_0x7aad79,_0x15306e){var _0x24acb3={'raw':!![],'where':{'id':_0x7aad79['params']['id']}},_0x538fa2={};_0x538fa2[_0x4023('0x32')]=_['keys'](db[_0x4023('0x2d')][_0x4023('0x2e')]);_0x538fa2[_0x4023('0x33')]=_['keys'](_0x7aad79[_0x4023('0x33')]);_0x538fa2[_0x4023('0x35')]=_[_0x4023('0x36')](_0x538fa2['model'],_0x538fa2[_0x4023('0x33')]);_0x24acb3[_0x4023('0x37')]=_[_0x4023('0x36')](_0x538fa2[_0x4023('0x32')],qs['fields'](_0x7aad79['query'][_0x4023('0x38')]));_0x24acb3[_0x4023('0x37')]=_0x24acb3['attributes'][_0x4023('0x39')]?_0x24acb3[_0x4023('0x37')]:_0x538fa2['model'];if(_0x7aad79[_0x4023('0x33')][_0x4023('0x43')]){_0x24acb3[_0x4023('0x44')]=[{'all':!![]}];}_0x24acb3=_['merge']({},_0x24acb3,_0x7aad79['options']);return db[_0x4023('0x2d')][_0x4023('0x47')](_0x24acb3)['then'](handleEntityNotFound(_0x15306e,null))[_0x4023('0x26')](respondWithResult(_0x15306e,null))[_0x4023('0x45')](handleError(_0x15306e,null));};exports[_0x4023('0x48')]=function(_0x2a42c1,_0x4ee6b2){return db[_0x4023('0x2d')][_0x4023('0x48')](_0x2a42c1['body'],{})[_0x4023('0x26')](respondWithResult(_0x4ee6b2,0xc9))[_0x4023('0x45')](handleError(_0x4ee6b2,null));};exports[_0x4023('0x24')]=function(_0x238951,_0x349c4d){if(_0x238951[_0x4023('0x49')]['id']){delete _0x238951[_0x4023('0x49')]['id'];}return db[_0x4023('0x2d')][_0x4023('0x47')]({'where':{'id':_0x238951[_0x4023('0x4a')]['id']}})[_0x4023('0x26')](handleEntityNotFound(_0x349c4d,null))[_0x4023('0x26')](saveUpdates(_0x238951['body'],null))['then'](respondWithResult(_0x349c4d,null))[_0x4023('0x45')](handleError(_0x349c4d,null));};exports['destroy']=function(_0x134f21,_0x30aa60){return db['SmsApplication']['find']({'where':{'id':_0x134f21[_0x4023('0x4a')]['id']}})[_0x4023('0x26')](handleEntityNotFound(_0x30aa60,null))[_0x4023('0x26')](removeEntity(_0x30aa60,null))[_0x4023('0x45')](handleError(_0x30aa60,null));};
\ No newline at end of file