Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / api / smsApplication / smsApplication.controller.js
index 3a9307e..9f80839 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f13=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','apply','reject','save','update','then','destroy','sendStatus','error','send','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','SmsApplication','count','findAll','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel'];(function(_0xe6770d,_0x22cd3b){var _0x1a8e1b=function(_0x1291e0){while(--_0x1291e0){_0xe6770d['push'](_0xe6770d['shift']());}};_0x1a8e1b(++_0x22cd3b);}(_0x0f13,0x16a));var _0x30f1=function(_0x4c3ebd,_0x35d1a0){_0x4c3ebd=_0x4c3ebd-0x0;var _0x47974a=_0x0f13[_0x4c3ebd];return _0x47974a;};'use strict';var pdf=require(_0x30f1('0x0'));var emlformat=require(_0x30f1('0x1'));var rimraf=require(_0x30f1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30f1('0x3'));var rp=require(_0x30f1('0x4'));var moment=require(_0x30f1('0x5'));var BPromise=require(_0x30f1('0x6'));var Mustache=require(_0x30f1('0x7'));var util=require(_0x30f1('0x8'));var path=require(_0x30f1('0x9'));var sox=require('sox');var csv=require(_0x30f1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x30f1('0xb'));var squel=require(_0x30f1('0xc'));var crypto=require(_0x30f1('0xd'));var jsforce=require(_0x30f1('0xe'));var deskjs=require(_0x30f1('0xf'));var toCsv=require(_0x30f1('0xa'));var querystring=require(_0x30f1('0x10'));var Papa=require('papaparse');var Redis=require(_0x30f1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x30f1('0x12'));var as=require(_0x30f1('0x13'));var hardwareService=require(_0x30f1('0x14'));var logger=require(_0x30f1('0x15'))(_0x30f1('0x16'));var utils=require(_0x30f1('0x17'));var config=require(_0x30f1('0x18'));var licenseUtil=require(_0x30f1('0x19'));var db=require(_0x30f1('0x1a'))['db'];function respondWithStatusCode(_0x2f3bdf,_0x329d32){_0x329d32=_0x329d32||0xcc;return function(_0x5e7cee){if(_0x5e7cee){return _0x2f3bdf['sendStatus'](_0x329d32);}return _0x2f3bdf['status'](_0x329d32)[_0x30f1('0x1b')]();};}function respondWithResult(_0x36795e,_0x55b9db){_0x55b9db=_0x55b9db||0xc8;return function(_0x1a9042){if(_0x1a9042){return _0x36795e[_0x30f1('0x1c')](_0x55b9db)[_0x30f1('0x1d')](_0x1a9042);}};}function respondWithFilteredResult(_0x3bdae8,_0x332cec){return function(_0x1eeb73){if(_0x1eeb73){var _0x5acddd=_0x1eeb73['count'],_0x54bc84=_0x332cec[_0x30f1('0x1e')],_0x229b39=_0x332cec[_0x30f1('0x1e')]+_0x332cec[_0x30f1('0x1f')],_0x4d85ae;if(_0x229b39>=_0x5acddd){_0x229b39=_0x5acddd;_0x4d85ae=0xc8;}else{_0x4d85ae=0xce;}_0x3bdae8[_0x30f1('0x1c')](_0x4d85ae);return _0x3bdae8['set']('Content-Range',_0x54bc84+'-'+_0x229b39+'/'+_0x5acddd)[_0x30f1('0x1d')](_0x1eeb73);}return null;};}function patchUpdates(_0x52938c){return function(_0x866f25){try{jsonpatch[_0x30f1('0x20')](_0x866f25,_0x52938c,!![]);}catch(_0x54f2c8){return BPromise[_0x30f1('0x21')](_0x54f2c8);}return _0x866f25[_0x30f1('0x22')]();};}function saveUpdates(_0x40655b,_0x56d265){return function(_0x550e97){if(_0x550e97){return _0x550e97[_0x30f1('0x23')](_0x40655b)[_0x30f1('0x24')](function(_0x540c04){return _0x540c04;});}return null;};}function removeEntity(_0x181b6b,_0x39914d){return function(_0x3895cc){if(_0x3895cc){return _0x3895cc[_0x30f1('0x25')]()[_0x30f1('0x24')](function(){_0x181b6b[_0x30f1('0x1c')](0xcc)[_0x30f1('0x1b')]();});}};}function handleEntityNotFound(_0x4b40a3,_0x13893e){return function(_0x272c83){if(!_0x272c83){_0x4b40a3[_0x30f1('0x26')](0x194);}return _0x272c83;};}function handleError(_0x36beea,_0x22852c){_0x22852c=_0x22852c||0x1f4;return function(_0x44d9a6){logger[_0x30f1('0x27')](_0x44d9a6['stack']);if(_0x44d9a6['name']){delete _0x44d9a6['name'];}_0x36beea[_0x30f1('0x1c')](_0x22852c)[_0x30f1('0x28')](_0x44d9a6);};}exports[_0x30f1('0x29')]=function(_0x119f05,_0x5976ad){var _0x2bac8f={},_0x3139fb={},_0x46ba1f={'count':0x0,'rows':[]};var _0x4c131d=_[_0x30f1('0x2a')](db['SmsApplication']['rawAttributes'],function(_0x2d5f14){return{'name':_0x2d5f14[_0x30f1('0x2b')],'type':_0x2d5f14[_0x30f1('0x2c')][_0x30f1('0x2d')]};});_0x3139fb['model']=_['map'](_0x4c131d,'name');_0x3139fb[_0x30f1('0x2e')]=_[_0x30f1('0x2f')](_0x119f05[_0x30f1('0x2e')]);_0x3139fb['filters']=_[_0x30f1('0x30')](_0x3139fb[_0x30f1('0x31')],_0x3139fb[_0x30f1('0x2e')]);_0x2bac8f[_0x30f1('0x32')]=_[_0x30f1('0x30')](_0x3139fb['model'],qs[_0x30f1('0x33')](_0x119f05[_0x30f1('0x2e')][_0x30f1('0x33')]));_0x2bac8f['attributes']=_0x2bac8f[_0x30f1('0x32')]['length']?_0x2bac8f[_0x30f1('0x32')]:_0x3139fb[_0x30f1('0x31')];if(!_0x119f05['query'][_0x30f1('0x34')]('nolimit')){_0x2bac8f[_0x30f1('0x1f')]=qs[_0x30f1('0x1f')](_0x119f05[_0x30f1('0x2e')]['limit']);_0x2bac8f[_0x30f1('0x1e')]=qs['offset'](_0x119f05[_0x30f1('0x2e')][_0x30f1('0x1e')]);}_0x2bac8f[_0x30f1('0x35')]=qs['sort'](_0x119f05[_0x30f1('0x2e')][_0x30f1('0x36')]);_0x2bac8f['where']=qs[_0x30f1('0x37')](_[_0x30f1('0x38')](_0x119f05[_0x30f1('0x2e')],_0x3139fb[_0x30f1('0x37')]),_0x4c131d);if(_0x119f05[_0x30f1('0x2e')][_0x30f1('0x39')]){_0x2bac8f[_0x30f1('0x3a')]=_[_0x30f1('0x3b')](_0x2bac8f[_0x30f1('0x3a')],{'$or':_[_0x30f1('0x2a')](_0x4c131d,function(_0x4fc7aa){if(_0x4fc7aa[_0x30f1('0x2c')]!==_0x30f1('0x3c')){var _0x59c36e={};_0x59c36e[_0x4fc7aa['name']]={'$like':'%'+_0x119f05[_0x30f1('0x2e')]['filter']+'%'};return _0x59c36e;}})});}_0x2bac8f=_['merge']({},_0x2bac8f,_0x119f05[_0x30f1('0x3d')]);var _0x4e2e74={'where':_0x2bac8f[_0x30f1('0x3a')]};return db[_0x30f1('0x3e')][_0x30f1('0x3f')](_0x4e2e74)['then'](function(_0x2bc678){_0x46ba1f[_0x30f1('0x3f')]=_0x2bc678;if(_0x119f05['query']['includeAll']){_0x2bac8f['include']=[{'all':!![]}];}return db[_0x30f1('0x3e')][_0x30f1('0x40')](_0x2bac8f);})[_0x30f1('0x24')](function(_0x46dfec){_0x46ba1f[_0x30f1('0x41')]=_0x46dfec;return _0x46ba1f;})[_0x30f1('0x24')](respondWithFilteredResult(_0x5976ad,_0x2bac8f))['catch'](handleError(_0x5976ad,null));};exports[_0x30f1('0x42')]=function(_0x110778,_0x4a05b3){var _0x407e36={'raw':!![],'where':{'id':_0x110778[_0x30f1('0x43')]['id']}},_0x5e0bd2={};_0x5e0bd2[_0x30f1('0x31')]=_['keys'](db['SmsApplication'][_0x30f1('0x44')]);_0x5e0bd2[_0x30f1('0x2e')]=_[_0x30f1('0x2f')](_0x110778[_0x30f1('0x2e')]);_0x5e0bd2[_0x30f1('0x37')]=_[_0x30f1('0x30')](_0x5e0bd2[_0x30f1('0x31')],_0x5e0bd2[_0x30f1('0x2e')]);_0x407e36['attributes']=_[_0x30f1('0x30')](_0x5e0bd2['model'],qs['fields'](_0x110778[_0x30f1('0x2e')]['fields']));_0x407e36['attributes']=_0x407e36[_0x30f1('0x32')]['length']?_0x407e36[_0x30f1('0x32')]:_0x5e0bd2[_0x30f1('0x31')];if(_0x110778[_0x30f1('0x2e')][_0x30f1('0x45')]){_0x407e36[_0x30f1('0x46')]=[{'all':!![]}];}_0x407e36=_['merge']({},_0x407e36,_0x110778['options']);return db['SmsApplication'][_0x30f1('0x47')](_0x407e36)['then'](handleEntityNotFound(_0x4a05b3,null))['then'](respondWithResult(_0x4a05b3,null))[_0x30f1('0x48')](handleError(_0x4a05b3,null));};exports['create']=function(_0x521c7f,_0x6d1342){return db[_0x30f1('0x3e')][_0x30f1('0x49')](_0x521c7f['body'],{})[_0x30f1('0x24')](respondWithResult(_0x6d1342,0xc9))[_0x30f1('0x48')](handleError(_0x6d1342,null));};exports[_0x30f1('0x23')]=function(_0x69dfc2,_0x1a5ac8){if(_0x69dfc2[_0x30f1('0x4a')]['id']){delete _0x69dfc2[_0x30f1('0x4a')]['id'];}return db[_0x30f1('0x3e')][_0x30f1('0x47')]({'where':{'id':_0x69dfc2[_0x30f1('0x43')]['id']}})[_0x30f1('0x24')](handleEntityNotFound(_0x1a5ac8,null))[_0x30f1('0x24')](saveUpdates(_0x69dfc2[_0x30f1('0x4a')],null))[_0x30f1('0x24')](respondWithResult(_0x1a5ac8,null))['catch'](handleError(_0x1a5ac8,null));};exports[_0x30f1('0x25')]=function(_0x107b4e,_0x3b2e49){return db[_0x30f1('0x3e')][_0x30f1('0x47')]({'where':{'id':_0x107b4e[_0x30f1('0x43')]['id']}})[_0x30f1('0x24')](handleEntityNotFound(_0x3b2e49,null))[_0x30f1('0x24')](removeEntity(_0x3b2e49,null))['catch'](handleError(_0x3b2e49,null));};
\ No newline at end of file
+var _0x4d06=['update','then','destroy','error','stack','name','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','count','includeAll','include','rows','catch','show','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save'];(function(_0x1f54d8,_0x35ebe5){var _0x17ff5a=function(_0x139a74){while(--_0x139a74){_0x1f54d8['push'](_0x1f54d8['shift']());}};_0x17ff5a(++_0x35ebe5);}(_0x4d06,0x100));var _0x64d0=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x4d06[_0x45f951];return _0x24756c;};'use strict';var pdf=require(_0x64d0('0x0'));var emlformat=require(_0x64d0('0x1'));var rimraf=require(_0x64d0('0x2'));var zipdir=require(_0x64d0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x64d0('0x4'));var BPromise=require(_0x64d0('0x5'));var Mustache=require(_0x64d0('0x6'));var util=require('util');var path=require(_0x64d0('0x7'));var sox=require(_0x64d0('0x8'));var csv=require(_0x64d0('0x9'));var ejs=require(_0x64d0('0xa'));var fs=require('fs');var _=require(_0x64d0('0xb'));var squel=require(_0x64d0('0xc'));var crypto=require(_0x64d0('0xd'));var jsforce=require(_0x64d0('0xe'));var deskjs=require(_0x64d0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x64d0('0x10'));var Papa=require('papaparse');var Redis=require(_0x64d0('0x11'));var authService=require(_0x64d0('0x12'));var qs=require(_0x64d0('0x13'));var as=require(_0x64d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64d0('0x15'))(_0x64d0('0x16'));var utils=require(_0x64d0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x64d0('0x18'));var db=require(_0x64d0('0x19'))['db'];function respondWithStatusCode(_0x4bfed5,_0x4592a3){_0x4592a3=_0x4592a3||0xcc;return function(_0x1dbff2){if(_0x1dbff2){return _0x4bfed5[_0x64d0('0x1a')](_0x4592a3);}return _0x4bfed5[_0x64d0('0x1b')](_0x4592a3)[_0x64d0('0x1c')]();};}function respondWithResult(_0x476127,_0x39044d){_0x39044d=_0x39044d||0xc8;return function(_0x2adbf1){if(_0x2adbf1){return _0x476127['status'](_0x39044d)[_0x64d0('0x1d')](_0x2adbf1);}};}function respondWithFilteredResult(_0x21390f,_0x25caec){return function(_0x230a0f){if(_0x230a0f){var _0x6556ec=_0x230a0f['count'],_0xb8042c=_0x25caec[_0x64d0('0x1e')],_0xdd28e8=_0x25caec[_0x64d0('0x1e')]+_0x25caec[_0x64d0('0x1f')],_0x5100ab;if(_0xdd28e8>=_0x6556ec){_0xdd28e8=_0x6556ec;_0x5100ab=0xc8;}else{_0x5100ab=0xce;}_0x21390f[_0x64d0('0x1b')](_0x5100ab);return _0x21390f['set'](_0x64d0('0x20'),_0xb8042c+'-'+_0xdd28e8+'/'+_0x6556ec)[_0x64d0('0x1d')](_0x230a0f);}return null;};}function patchUpdates(_0x450ea7){return function(_0x36e4df){try{jsonpatch[_0x64d0('0x21')](_0x36e4df,_0x450ea7,!![]);}catch(_0x15e8ff){return BPromise[_0x64d0('0x22')](_0x15e8ff);}return _0x36e4df[_0x64d0('0x23')]();};}function saveUpdates(_0x57c991,_0x36904b){return function(_0x5681c){if(_0x5681c){return _0x5681c[_0x64d0('0x24')](_0x57c991)[_0x64d0('0x25')](function(_0xbedb91){return _0xbedb91;});}return null;};}function removeEntity(_0x773a0b,_0x51937c){return function(_0x31153d){if(_0x31153d){return _0x31153d[_0x64d0('0x26')]()[_0x64d0('0x25')](function(){_0x773a0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cced,_0x233d2f){return function(_0x47678c){if(!_0x47678c){_0x16cced[_0x64d0('0x1a')](0x194);}return _0x47678c;};}function handleError(_0x20a2ea,_0x33b730){_0x33b730=_0x33b730||0x1f4;return function(_0x2cc097){logger[_0x64d0('0x27')](_0x2cc097[_0x64d0('0x28')]);if(_0x2cc097[_0x64d0('0x29')]){delete _0x2cc097[_0x64d0('0x29')];}_0x20a2ea[_0x64d0('0x1b')](_0x33b730)['send'](_0x2cc097);};}exports[_0x64d0('0x2a')]=function(_0x5cf706,_0x47f4da){var _0xf07f92={},_0x3c8aa7={},_0x5ddfec={'count':0x0,'rows':[]};var _0x5ea8bc=_['map'](db[_0x64d0('0x2b')][_0x64d0('0x2c')],function(_0x347fa6){return{'name':_0x347fa6[_0x64d0('0x2d')],'type':_0x347fa6[_0x64d0('0x2e')][_0x64d0('0x2f')]};});_0x3c8aa7[_0x64d0('0x30')]=_[_0x64d0('0x31')](_0x5ea8bc,_0x64d0('0x29'));_0x3c8aa7[_0x64d0('0x32')]=_['keys'](_0x5cf706[_0x64d0('0x32')]);_0x3c8aa7[_0x64d0('0x33')]=_[_0x64d0('0x34')](_0x3c8aa7[_0x64d0('0x30')],_0x3c8aa7[_0x64d0('0x32')]);_0xf07f92['attributes']=_[_0x64d0('0x34')](_0x3c8aa7['model'],qs[_0x64d0('0x35')](_0x5cf706[_0x64d0('0x32')][_0x64d0('0x35')]));_0xf07f92[_0x64d0('0x36')]=_0xf07f92['attributes'][_0x64d0('0x37')]?_0xf07f92[_0x64d0('0x36')]:_0x3c8aa7[_0x64d0('0x30')];if(!_0x5cf706[_0x64d0('0x32')]['hasOwnProperty'](_0x64d0('0x38'))){_0xf07f92['limit']=qs[_0x64d0('0x1f')](_0x5cf706[_0x64d0('0x32')][_0x64d0('0x1f')]);_0xf07f92[_0x64d0('0x1e')]=qs[_0x64d0('0x1e')](_0x5cf706[_0x64d0('0x32')][_0x64d0('0x1e')]);}_0xf07f92[_0x64d0('0x39')]=qs[_0x64d0('0x3a')](_0x5cf706['query'][_0x64d0('0x3a')]);_0xf07f92[_0x64d0('0x3b')]=qs[_0x64d0('0x33')](_[_0x64d0('0x3c')](_0x5cf706[_0x64d0('0x32')],_0x3c8aa7[_0x64d0('0x33')]),_0x5ea8bc);if(_0x5cf706[_0x64d0('0x32')]['filter']){_0xf07f92[_0x64d0('0x3b')]=_[_0x64d0('0x3d')](_0xf07f92[_0x64d0('0x3b')],{'$or':_[_0x64d0('0x31')](_0x5ea8bc,function(_0x54e6ea){if(_0x54e6ea[_0x64d0('0x2e')]!=='VIRTUAL'){var _0x20f914={};_0x20f914[_0x54e6ea['name']]={'$like':'%'+_0x5cf706[_0x64d0('0x32')]['filter']+'%'};return _0x20f914;}})});}_0xf07f92=_[_0x64d0('0x3d')]({},_0xf07f92,_0x5cf706['options']);var _0xd227da={'where':_0xf07f92[_0x64d0('0x3b')]};return db['SmsApplication']['count'](_0xd227da)[_0x64d0('0x25')](function(_0x566da7){_0x5ddfec[_0x64d0('0x3e')]=_0x566da7;if(_0x5cf706[_0x64d0('0x32')][_0x64d0('0x3f')]){_0xf07f92[_0x64d0('0x40')]=[{'all':!![]}];}return db[_0x64d0('0x2b')]['findAll'](_0xf07f92);})[_0x64d0('0x25')](function(_0x5b55da){_0x5ddfec[_0x64d0('0x41')]=_0x5b55da;return _0x5ddfec;})['then'](respondWithFilteredResult(_0x47f4da,_0xf07f92))[_0x64d0('0x42')](handleError(_0x47f4da,null));};exports[_0x64d0('0x43')]=function(_0x24fdc0,_0x2581e8){var _0x9bf9a7={'raw':!![],'where':{'id':_0x24fdc0['params']['id']}},_0x369338={};_0x369338['model']=_['keys'](db[_0x64d0('0x2b')][_0x64d0('0x2c')]);_0x369338[_0x64d0('0x32')]=_[_0x64d0('0x44')](_0x24fdc0[_0x64d0('0x32')]);_0x369338[_0x64d0('0x33')]=_[_0x64d0('0x34')](_0x369338[_0x64d0('0x30')],_0x369338[_0x64d0('0x32')]);_0x9bf9a7[_0x64d0('0x36')]=_[_0x64d0('0x34')](_0x369338[_0x64d0('0x30')],qs[_0x64d0('0x35')](_0x24fdc0[_0x64d0('0x32')][_0x64d0('0x35')]));_0x9bf9a7['attributes']=_0x9bf9a7[_0x64d0('0x36')][_0x64d0('0x37')]?_0x9bf9a7[_0x64d0('0x36')]:_0x369338[_0x64d0('0x30')];if(_0x24fdc0[_0x64d0('0x32')]['includeAll']){_0x9bf9a7[_0x64d0('0x40')]=[{'all':!![]}];}_0x9bf9a7=_[_0x64d0('0x3d')]({},_0x9bf9a7,_0x24fdc0[_0x64d0('0x45')]);return db[_0x64d0('0x2b')][_0x64d0('0x46')](_0x9bf9a7)[_0x64d0('0x25')](handleEntityNotFound(_0x2581e8,null))[_0x64d0('0x25')](respondWithResult(_0x2581e8,null))['catch'](handleError(_0x2581e8,null));};exports[_0x64d0('0x47')]=function(_0x4a70ef,_0x12f12f){return db[_0x64d0('0x2b')][_0x64d0('0x47')](_0x4a70ef[_0x64d0('0x48')],{})[_0x64d0('0x25')](respondWithResult(_0x12f12f,0xc9))[_0x64d0('0x42')](handleError(_0x12f12f,null));};exports[_0x64d0('0x24')]=function(_0x813559,_0x492e32){if(_0x813559[_0x64d0('0x48')]['id']){delete _0x813559[_0x64d0('0x48')]['id'];}return db[_0x64d0('0x2b')]['find']({'where':{'id':_0x813559['params']['id']}})[_0x64d0('0x25')](handleEntityNotFound(_0x492e32,null))[_0x64d0('0x25')](saveUpdates(_0x813559['body'],null))[_0x64d0('0x25')](respondWithResult(_0x492e32,null))[_0x64d0('0x42')](handleError(_0x492e32,null));};exports[_0x64d0('0x26')]=function(_0x227ed9,_0x1f60bf){return db[_0x64d0('0x2b')][_0x64d0('0x46')]({'where':{'id':_0x227ed9['params']['id']}})[_0x64d0('0x25')](handleEntityNotFound(_0x1f60bf,null))[_0x64d0('0x25')](removeEntity(_0x1f60bf,null))[_0x64d0('0x42')](handleError(_0x1f60bf,null));};
\ No newline at end of file