Built motion from commit 3e059bc2.|2.5.32
[motion2.git] / server / api / smsApplication / smsApplication.controller.js
index fdc62a1..d6b9ade 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8396=['Content-Range','apply','reject','save','update','destroy','then','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','SmsApplication','includeAll','include','findAll','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set'];(function(_0x1199bd,_0x4f77db){var _0x1371f0=function(_0x57dbfa){while(--_0x57dbfa){_0x1199bd['push'](_0x1199bd['shift']());}};_0x1371f0(++_0x4f77db);}(_0x8396,0xf6));var _0x6839=function(_0x3ca9e2,_0x2454fd){_0x3ca9e2=_0x3ca9e2-0x0;var _0x3e54c1=_0x8396[_0x3ca9e2];return _0x3e54c1;};'use strict';var pdf=require(_0x6839('0x0'));var emlformat=require(_0x6839('0x1'));var rimraf=require(_0x6839('0x2'));var zipdir=require(_0x6839('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6839('0x4'));var Mustache=require(_0x6839('0x5'));var util=require(_0x6839('0x6'));var path=require(_0x6839('0x7'));var sox=require('sox');var csv=require(_0x6839('0x8'));var ejs=require(_0x6839('0x9'));var fs=require('fs');var _=require(_0x6839('0xa'));var squel=require(_0x6839('0xb'));var crypto=require(_0x6839('0xc'));var jsforce=require(_0x6839('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6839('0x8'));var querystring=require('querystring');var Papa=require(_0x6839('0xe'));var Redis=require(_0x6839('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6839('0x10'));var as=require(_0x6839('0x11'));var hardwareService=require(_0x6839('0x12'));var logger=require(_0x6839('0x13'))(_0x6839('0x14'));var utils=require('../../config/utils');var config=require(_0x6839('0x15'));var db=require(_0x6839('0x16'))['db'];function respondWithStatusCode(_0x512e53,_0x5ac72a){_0x5ac72a=_0x5ac72a||0xcc;return function(_0x188de4){if(_0x188de4){return _0x512e53['sendStatus'](_0x5ac72a);}return _0x512e53[_0x6839('0x17')](_0x5ac72a)[_0x6839('0x18')]();};}function respondWithResult(_0x5b751e,_0x4218c9){_0x4218c9=_0x4218c9||0xc8;return function(_0x2b4a33){if(_0x2b4a33){return _0x5b751e[_0x6839('0x17')](_0x4218c9)[_0x6839('0x19')](_0x2b4a33);}};}function respondWithFilteredResult(_0x2fe99d,_0xf06afd){return function(_0x22cbbd){if(_0x22cbbd){var _0x1ed3af=_0x22cbbd[_0x6839('0x1a')],_0x1fdb01=_0xf06afd['offset'],_0x552e93=_0xf06afd[_0x6839('0x1b')]+_0xf06afd[_0x6839('0x1c')],_0x2d2797;if(_0x552e93>=_0x1ed3af){_0x552e93=_0x1ed3af;_0x2d2797=0xc8;}else{_0x2d2797=0xce;}_0x2fe99d['status'](_0x2d2797);return _0x2fe99d[_0x6839('0x1d')](_0x6839('0x1e'),_0x1fdb01+'-'+_0x552e93+'/'+_0x1ed3af)[_0x6839('0x19')](_0x22cbbd);}return null;};}function patchUpdates(_0x1435ec){return function(_0x117098){try{jsonpatch[_0x6839('0x1f')](_0x117098,_0x1435ec,!![]);}catch(_0x37079a){return BPromise[_0x6839('0x20')](_0x37079a);}return _0x117098[_0x6839('0x21')]();};}function saveUpdates(_0x2dd135,_0xf9bb45){return function(_0x46ac2a){if(_0x46ac2a){return _0x46ac2a[_0x6839('0x22')](_0x2dd135)['then'](function(_0x47fc6a){return _0x47fc6a;});}return null;};}function removeEntity(_0x4c204e,_0x13d2b8){return function(_0x17b3c8){if(_0x17b3c8){return _0x17b3c8[_0x6839('0x23')]()[_0x6839('0x24')](function(){_0x4c204e[_0x6839('0x17')](0xcc)[_0x6839('0x18')]();});}};}function handleEntityNotFound(_0x2d201f,_0x5c0bb7){return function(_0xab1b90){if(!_0xab1b90){_0x2d201f['sendStatus'](0x194);}return _0xab1b90;};}function handleError(_0x40d881,_0x160c6d){_0x160c6d=_0x160c6d||0x1f4;return function(_0x3ede31){logger['error'](_0x3ede31['stack']);if(_0x3ede31[_0x6839('0x25')]){delete _0x3ede31[_0x6839('0x25')];}_0x40d881[_0x6839('0x17')](_0x160c6d)['send'](_0x3ede31);};}exports[_0x6839('0x26')]=function(_0x4da159,_0x13b407){var _0x4ae1d4={},_0x1f0856={},_0x4604ab={'count':0x0,'rows':[]};var _0x348f0d=_[_0x6839('0x27')](db['SmsApplication'][_0x6839('0x28')],function(_0x4e1fe1){return{'name':_0x4e1fe1[_0x6839('0x29')],'type':_0x4e1fe1[_0x6839('0x2a')]['key']};});_0x1f0856[_0x6839('0x2b')]=_['map'](_0x348f0d,_0x6839('0x25'));_0x1f0856[_0x6839('0x2c')]=_[_0x6839('0x2d')](_0x4da159[_0x6839('0x2c')]);_0x1f0856[_0x6839('0x2e')]=_[_0x6839('0x2f')](_0x1f0856[_0x6839('0x2b')],_0x1f0856[_0x6839('0x2c')]);_0x4ae1d4[_0x6839('0x30')]=_[_0x6839('0x2f')](_0x1f0856[_0x6839('0x2b')],qs[_0x6839('0x31')](_0x4da159[_0x6839('0x2c')][_0x6839('0x31')]));_0x4ae1d4[_0x6839('0x30')]=_0x4ae1d4[_0x6839('0x30')][_0x6839('0x32')]?_0x4ae1d4[_0x6839('0x30')]:_0x1f0856['model'];if(!_0x4da159[_0x6839('0x2c')][_0x6839('0x33')](_0x6839('0x34'))){_0x4ae1d4[_0x6839('0x1c')]=qs[_0x6839('0x1c')](_0x4da159[_0x6839('0x2c')][_0x6839('0x1c')]);_0x4ae1d4[_0x6839('0x1b')]=qs[_0x6839('0x1b')](_0x4da159['query'][_0x6839('0x1b')]);}_0x4ae1d4[_0x6839('0x35')]=qs[_0x6839('0x36')](_0x4da159['query'][_0x6839('0x36')]);_0x4ae1d4[_0x6839('0x37')]=qs['filters'](_['pick'](_0x4da159[_0x6839('0x2c')],_0x1f0856[_0x6839('0x2e')]));if(_0x4da159['query'][_0x6839('0x38')]){_0x4ae1d4[_0x6839('0x37')]=_[_0x6839('0x39')](_0x4ae1d4[_0x6839('0x37')],{'$or':_['map'](_0x348f0d,function(_0x36821c){if(_0x36821c[_0x6839('0x2a')]!==_0x6839('0x3a')){var _0x389d8a={};_0x389d8a[_0x36821c['name']]={'$like':'%'+_0x4da159['query'][_0x6839('0x38')]+'%'};return _0x389d8a;}})});}_0x4ae1d4=_['merge']({},_0x4ae1d4,_0x4da159['options']);var _0x853c30={'where':_0x4ae1d4[_0x6839('0x37')]};return db[_0x6839('0x3b')][_0x6839('0x1a')](_0x853c30)[_0x6839('0x24')](function(_0x320684){_0x4604ab[_0x6839('0x1a')]=_0x320684;if(_0x4da159[_0x6839('0x2c')][_0x6839('0x3c')]){_0x4ae1d4[_0x6839('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x6839('0x3e')](_0x4ae1d4);})[_0x6839('0x24')](function(_0x13ee35){_0x4604ab['rows']=_0x13ee35;return _0x4604ab;})[_0x6839('0x24')](respondWithFilteredResult(_0x13b407,_0x4ae1d4))[_0x6839('0x3f')](handleError(_0x13b407,null));};exports[_0x6839('0x40')]=function(_0x44cbaa,_0x430838){var _0x1a6aef={'raw':!![],'where':{'id':_0x44cbaa[_0x6839('0x41')]['id']}},_0x3bdf3e={};_0x3bdf3e[_0x6839('0x2b')]=_[_0x6839('0x2d')](db['SmsApplication']['rawAttributes']);_0x3bdf3e[_0x6839('0x2c')]=_[_0x6839('0x2d')](_0x44cbaa[_0x6839('0x2c')]);_0x3bdf3e['filters']=_[_0x6839('0x2f')](_0x3bdf3e['model'],_0x3bdf3e[_0x6839('0x2c')]);_0x1a6aef[_0x6839('0x30')]=_[_0x6839('0x2f')](_0x3bdf3e[_0x6839('0x2b')],qs[_0x6839('0x31')](_0x44cbaa[_0x6839('0x2c')][_0x6839('0x31')]));_0x1a6aef['attributes']=_0x1a6aef[_0x6839('0x30')][_0x6839('0x32')]?_0x1a6aef[_0x6839('0x30')]:_0x3bdf3e['model'];if(_0x44cbaa['query'][_0x6839('0x3c')]){_0x1a6aef['include']=[{'all':!![]}];}_0x1a6aef=_['merge']({},_0x1a6aef,_0x44cbaa['options']);return db[_0x6839('0x3b')]['find'](_0x1a6aef)[_0x6839('0x24')](handleEntityNotFound(_0x430838,null))[_0x6839('0x24')](respondWithResult(_0x430838,null))['catch'](handleError(_0x430838,null));};exports[_0x6839('0x42')]=function(_0x19998d,_0x26e924){return db[_0x6839('0x3b')][_0x6839('0x42')](_0x19998d[_0x6839('0x43')],{})[_0x6839('0x24')](respondWithResult(_0x26e924,0xc9))[_0x6839('0x3f')](handleError(_0x26e924,null));};exports[_0x6839('0x22')]=function(_0x1c4593,_0x308e85){if(_0x1c4593[_0x6839('0x43')]['id']){delete _0x1c4593[_0x6839('0x43')]['id'];}return db[_0x6839('0x3b')]['find']({'where':{'id':_0x1c4593['params']['id']}})[_0x6839('0x24')](handleEntityNotFound(_0x308e85,null))['then'](saveUpdates(_0x1c4593['body'],null))['then'](respondWithResult(_0x308e85,null))[_0x6839('0x3f')](handleError(_0x308e85,null));};exports[_0x6839('0x23')]=function(_0x389419,_0x25264f){return db[_0x6839('0x3b')][_0x6839('0x44')]({'where':{'id':_0x389419[_0x6839('0x41')]['id']}})['then'](handleEntityNotFound(_0x25264f,null))[_0x6839('0x24')](removeEntity(_0x25264f,null))[_0x6839('0x3f')](handleError(_0x25264f,null));};
\ No newline at end of file
+var _0xd4a7=['to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','then','destroy','error','send','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x87704,_0x1d745d){var _0x4cba34=function(_0x4fd495){while(--_0x4fd495){_0x87704['push'](_0x87704['shift']());}};_0x4cba34(++_0x1d745d);}(_0xd4a7,0x1bd));var _0x7d4a=function(_0x5d3892,_0x3df3ac){_0x5d3892=_0x5d3892-0x0;var _0x487a9f=_0xd4a7[_0x5d3892];return _0x487a9f;};'use strict';var emlformat=require(_0x7d4a('0x0'));var rimraf=require(_0x7d4a('0x1'));var zipdir=require(_0x7d4a('0x2'));var jsonpatch=require(_0x7d4a('0x3'));var rp=require(_0x7d4a('0x4'));var moment=require(_0x7d4a('0x5'));var BPromise=require(_0x7d4a('0x6'));var Mustache=require(_0x7d4a('0x7'));var util=require(_0x7d4a('0x8'));var path=require(_0x7d4a('0x9'));var sox=require(_0x7d4a('0xa'));var csv=require(_0x7d4a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d4a('0xc'));var _=require(_0x7d4a('0xd'));var squel=require('squel');var crypto=require(_0x7d4a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7d4a('0xf'));var toCsv=require(_0x7d4a('0xb'));var querystring=require(_0x7d4a('0x10'));var Papa=require('papaparse');var Redis=require(_0x7d4a('0x11'));var authService=require(_0x7d4a('0x12'));var qs=require(_0x7d4a('0x13'));var as=require(_0x7d4a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d4a('0x15'))(_0x7d4a('0x16'));var utils=require(_0x7d4a('0x17'));var config=require(_0x7d4a('0x18'));var licenseUtil=require(_0x7d4a('0x19'));var db=require(_0x7d4a('0x1a'))['db'];function respondWithStatusCode(_0x43c4b9,_0x21bcfe){_0x21bcfe=_0x21bcfe||0xcc;return function(_0x2ef972){if(_0x2ef972){return _0x43c4b9[_0x7d4a('0x1b')](_0x21bcfe);}return _0x43c4b9['status'](_0x21bcfe)[_0x7d4a('0x1c')]();};}function respondWithResult(_0x2f741e,_0xbc56d2){_0xbc56d2=_0xbc56d2||0xc8;return function(_0x35d0ed){if(_0x35d0ed){return _0x2f741e[_0x7d4a('0x1d')](_0xbc56d2)[_0x7d4a('0x1e')](_0x35d0ed);}};}function respondWithFilteredResult(_0x92c55f,_0x11971a){return function(_0x435e91){if(_0x435e91){var _0x3bc410=typeof _0x11971a[_0x7d4a('0x1f')]===_0x7d4a('0x20')&&typeof _0x11971a[_0x7d4a('0x21')]===_0x7d4a('0x20');var _0x14c4d3=_0x435e91['count'];var _0x350ad8=_0x3bc410?0x0:_0x11971a[_0x7d4a('0x1f')];var _0x8660f9=_0x3bc410?_0x435e91[_0x7d4a('0x22')]:_0x11971a['offset']+_0x11971a['limit'];var _0x61ad6e;if(_0x8660f9>=_0x14c4d3){_0x8660f9=_0x14c4d3;_0x61ad6e=0xc8;}else{_0x61ad6e=0xce;}_0x92c55f[_0x7d4a('0x1d')](_0x61ad6e);return _0x92c55f[_0x7d4a('0x23')]('Content-Range',_0x350ad8+'-'+_0x8660f9+'/'+_0x14c4d3)[_0x7d4a('0x1e')](_0x435e91);}return null;};}function patchUpdates(_0x1e0656){return function(_0xac943e){try{jsonpatch['apply'](_0xac943e,_0x1e0656,!![]);}catch(_0x3751d9){return BPromise[_0x7d4a('0x24')](_0x3751d9);}return _0xac943e['save']();};}function saveUpdates(_0x56f4e5,_0x469b1b){return function(_0x1b064d){if(_0x1b064d){return _0x1b064d['update'](_0x56f4e5)[_0x7d4a('0x25')](function(_0xae3543){return _0xae3543;});}return null;};}function removeEntity(_0x432c95,_0x158b2d){return function(_0x453687){if(_0x453687){return _0x453687[_0x7d4a('0x26')]()[_0x7d4a('0x25')](function(){_0x432c95[_0x7d4a('0x1d')](0xcc)[_0x7d4a('0x1c')]();});}};}function handleEntityNotFound(_0x457631,_0x53f5ab){return function(_0x46774a){if(!_0x46774a){_0x457631[_0x7d4a('0x1b')](0x194);}return _0x46774a;};}function handleError(_0xc27ff3,_0xcc434){_0xcc434=_0xcc434||0x1f4;return function(_0x42216c){logger[_0x7d4a('0x27')](_0x42216c['stack']);if(_0x42216c['name']){delete _0x42216c['name'];}_0xc27ff3[_0x7d4a('0x1d')](_0xcc434)[_0x7d4a('0x28')](_0x42216c);};}exports['index']=function(_0x4d7172,_0x27c400){var _0x2a199a={},_0x17b675={},_0x3cd1e0={'count':0x0,'rows':[]};var _0x672744=_[_0x7d4a('0x29')](db[_0x7d4a('0x2a')][_0x7d4a('0x2b')],function(_0x8e89f8){return{'name':_0x8e89f8[_0x7d4a('0x2c')],'type':_0x8e89f8[_0x7d4a('0x2d')][_0x7d4a('0x2e')]};});_0x17b675['model']=_['map'](_0x672744,'name');_0x17b675[_0x7d4a('0x2f')]=_[_0x7d4a('0x30')](_0x4d7172['query']);_0x17b675[_0x7d4a('0x31')]=_[_0x7d4a('0x32')](_0x17b675[_0x7d4a('0x33')],_0x17b675[_0x7d4a('0x2f')]);_0x2a199a[_0x7d4a('0x34')]=_['intersection'](_0x17b675['model'],qs[_0x7d4a('0x35')](_0x4d7172[_0x7d4a('0x2f')][_0x7d4a('0x35')]));_0x2a199a[_0x7d4a('0x34')]=_0x2a199a['attributes'][_0x7d4a('0x36')]?_0x2a199a['attributes']:_0x17b675[_0x7d4a('0x33')];if(!_0x4d7172[_0x7d4a('0x2f')][_0x7d4a('0x37')](_0x7d4a('0x38'))){_0x2a199a[_0x7d4a('0x21')]=qs[_0x7d4a('0x21')](_0x4d7172[_0x7d4a('0x2f')][_0x7d4a('0x21')]);_0x2a199a[_0x7d4a('0x1f')]=qs[_0x7d4a('0x1f')](_0x4d7172[_0x7d4a('0x2f')]['offset']);}_0x2a199a[_0x7d4a('0x39')]=qs[_0x7d4a('0x3a')](_0x4d7172['query'][_0x7d4a('0x3a')]);_0x2a199a[_0x7d4a('0x3b')]=qs[_0x7d4a('0x31')](_[_0x7d4a('0x3c')](_0x4d7172[_0x7d4a('0x2f')],_0x17b675[_0x7d4a('0x31')]),_0x672744);if(_0x4d7172['query']['filter']){_0x2a199a[_0x7d4a('0x3b')]=_['merge'](_0x2a199a[_0x7d4a('0x3b')],{'$or':_[_0x7d4a('0x29')](_0x672744,function(_0x1a0d62){if(_0x1a0d62['type']!==_0x7d4a('0x3d')){var _0x56001c={};_0x56001c[_0x1a0d62['name']]={'$like':'%'+_0x4d7172[_0x7d4a('0x2f')][_0x7d4a('0x3e')]+'%'};return _0x56001c;}})});}_0x2a199a=_[_0x7d4a('0x3f')]({},_0x2a199a,_0x4d7172[_0x7d4a('0x40')]);var _0x1559a7={'where':_0x2a199a[_0x7d4a('0x3b')]};return db['SmsApplication'][_0x7d4a('0x22')](_0x1559a7)[_0x7d4a('0x25')](function(_0x5d9e20){_0x3cd1e0['count']=_0x5d9e20;if(_0x4d7172[_0x7d4a('0x2f')]['includeAll']){_0x2a199a[_0x7d4a('0x41')]=[{'all':!![]}];}return db[_0x7d4a('0x2a')][_0x7d4a('0x42')](_0x2a199a);})[_0x7d4a('0x25')](function(_0x44e5a0){_0x3cd1e0[_0x7d4a('0x43')]=_0x44e5a0;return _0x3cd1e0;})[_0x7d4a('0x25')](respondWithFilteredResult(_0x27c400,_0x2a199a))['catch'](handleError(_0x27c400,null));};exports[_0x7d4a('0x44')]=function(_0x3b1106,_0x4102ab){var _0x1ba18f={'raw':!![],'where':{'id':_0x3b1106[_0x7d4a('0x45')]['id']}},_0x5d3604={};_0x5d3604[_0x7d4a('0x33')]=_[_0x7d4a('0x30')](db['SmsApplication'][_0x7d4a('0x2b')]);_0x5d3604[_0x7d4a('0x2f')]=_['keys'](_0x3b1106[_0x7d4a('0x2f')]);_0x5d3604[_0x7d4a('0x31')]=_[_0x7d4a('0x32')](_0x5d3604['model'],_0x5d3604['query']);_0x1ba18f[_0x7d4a('0x34')]=_[_0x7d4a('0x32')](_0x5d3604['model'],qs[_0x7d4a('0x35')](_0x3b1106[_0x7d4a('0x2f')]['fields']));_0x1ba18f[_0x7d4a('0x34')]=_0x1ba18f[_0x7d4a('0x34')][_0x7d4a('0x36')]?_0x1ba18f['attributes']:_0x5d3604[_0x7d4a('0x33')];if(_0x3b1106[_0x7d4a('0x2f')][_0x7d4a('0x46')]){_0x1ba18f['include']=[{'all':!![]}];}_0x1ba18f=_[_0x7d4a('0x3f')]({},_0x1ba18f,_0x3b1106['options']);return db[_0x7d4a('0x2a')][_0x7d4a('0x47')](_0x1ba18f)['then'](handleEntityNotFound(_0x4102ab,null))[_0x7d4a('0x25')](respondWithResult(_0x4102ab,null))[_0x7d4a('0x48')](handleError(_0x4102ab,null));};exports['create']=function(_0x142c8e,_0x3a2fc5){return db[_0x7d4a('0x2a')][_0x7d4a('0x49')](_0x142c8e[_0x7d4a('0x4a')],{})[_0x7d4a('0x25')](respondWithResult(_0x3a2fc5,0xc9))[_0x7d4a('0x48')](handleError(_0x3a2fc5,null));};exports[_0x7d4a('0x4b')]=function(_0x287629,_0x50e21b){if(_0x287629[_0x7d4a('0x4a')]['id']){delete _0x287629['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x287629[_0x7d4a('0x45')]['id']}})[_0x7d4a('0x25')](handleEntityNotFound(_0x50e21b,null))[_0x7d4a('0x25')](saveUpdates(_0x287629[_0x7d4a('0x4a')],null))[_0x7d4a('0x25')](respondWithResult(_0x50e21b,null))[_0x7d4a('0x48')](handleError(_0x50e21b,null));};exports['destroy']=function(_0x3012b6,_0x55116a){return db['SmsApplication'][_0x7d4a('0x47')]({'where':{'id':_0x3012b6['params']['id']}})[_0x7d4a('0x25')](handleEntityNotFound(_0x55116a,null))[_0x7d4a('0x25')](removeEntity(_0x55116a,null))['catch'](handleError(_0x55116a,null));};
\ No newline at end of file