Built motion from commit 753c950e.|2.5.42
[motion2.git] / server / api / openchannelApplication / openchannelApplication.controller.js
index 5e565cb..6b9d601 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9026=['moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','params','model','find','create','body','eml-format','rimraf','request-promise'];(function(_0x210ec9,_0x901f4e){var _0x118e5f=function(_0x52119b){while(--_0x52119b){_0x210ec9['push'](_0x210ec9['shift']());}};_0x118e5f(++_0x901f4e);}(_0x9026,0x15b));var _0x6902=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9026[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6902('0x0'));var rimraf=require(_0x6902('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6902('0x2'));var moment=require(_0x6902('0x3'));var BPromise=require(_0x6902('0x4'));var Mustache=require(_0x6902('0x5'));var util=require(_0x6902('0x6'));var path=require('path');var sox=require(_0x6902('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6902('0x8'));var squel=require(_0x6902('0x9'));var crypto=require(_0x6902('0xa'));var jsforce=require(_0x6902('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6902('0xc'));var querystring=require('querystring');var Papa=require(_0x6902('0xd'));var Redis=require(_0x6902('0xe'));var authService=require(_0x6902('0xf'));var qs=require(_0x6902('0x10'));var as=require(_0x6902('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6902('0x12'))(_0x6902('0x13'));var utils=require('../../config/utils');var config=require(_0x6902('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6902('0x15'))['db'];function respondWithStatusCode(_0x4f0e38,_0x25fc04){_0x25fc04=_0x25fc04||0xcc;return function(_0x28b9e6){if(_0x28b9e6){return _0x4f0e38[_0x6902('0x16')](_0x25fc04);}return _0x4f0e38[_0x6902('0x17')](_0x25fc04)[_0x6902('0x18')]();};}function respondWithResult(_0x4e26ed,_0x461736){_0x461736=_0x461736||0xc8;return function(_0x24f8d9){if(_0x24f8d9){return _0x4e26ed['status'](_0x461736)[_0x6902('0x19')](_0x24f8d9);}};}function respondWithFilteredResult(_0x112380,_0x12e007){return function(_0x5e0ea6){if(_0x5e0ea6){var _0x44d704=_0x5e0ea6[_0x6902('0x1a')],_0x466b2e=_0x12e007[_0x6902('0x1b')],_0x18c697=_0x12e007['offset']+_0x12e007[_0x6902('0x1c')],_0x25163f;if(_0x18c697>=_0x44d704){_0x18c697=_0x44d704;_0x25163f=0xc8;}else{_0x25163f=0xce;}_0x112380[_0x6902('0x17')](_0x25163f);return _0x112380['set'](_0x6902('0x1d'),_0x466b2e+'-'+_0x18c697+'/'+_0x44d704)['json'](_0x5e0ea6);}return null;};}function patchUpdates(_0x22bf7c){return function(_0x1f56ef){try{jsonpatch[_0x6902('0x1e')](_0x1f56ef,_0x22bf7c,!![]);}catch(_0x1d02fc){return BPromise['reject'](_0x1d02fc);}return _0x1f56ef[_0x6902('0x1f')]();};}function saveUpdates(_0x1c9782,_0x5c8acd){return function(_0x1ac474){if(_0x1ac474){return _0x1ac474[_0x6902('0x20')](_0x1c9782)['then'](function(_0x57bc6a){return _0x57bc6a;});}return null;};}function removeEntity(_0x1f721e,_0xf59043){return function(_0x532e30){if(_0x532e30){return _0x532e30[_0x6902('0x21')]()[_0x6902('0x22')](function(){_0x1f721e[_0x6902('0x17')](0xcc)[_0x6902('0x18')]();});}};}function handleEntityNotFound(_0x14aeae,_0x290338){return function(_0x226970){if(!_0x226970){_0x14aeae[_0x6902('0x16')](0x194);}return _0x226970;};}function handleError(_0x4da473,_0x1944e3){_0x1944e3=_0x1944e3||0x1f4;return function(_0x3970f1){logger[_0x6902('0x23')](_0x3970f1[_0x6902('0x24')]);if(_0x3970f1[_0x6902('0x25')]){delete _0x3970f1['name'];}_0x4da473['status'](_0x1944e3)[_0x6902('0x26')](_0x3970f1);};}exports[_0x6902('0x27')]=function(_0x423534,_0x1ccaad){var _0xe25c38={},_0x5b8d61={},_0x33eab1={'count':0x0,'rows':[]};var _0x24d958=_[_0x6902('0x28')](db[_0x6902('0x29')][_0x6902('0x2a')],function(_0x1a603f){return{'name':_0x1a603f[_0x6902('0x2b')],'type':_0x1a603f['type'][_0x6902('0x2c')]};});_0x5b8d61['model']=_['map'](_0x24d958,'name');_0x5b8d61[_0x6902('0x2d')]=_[_0x6902('0x2e')](_0x423534['query']);_0x5b8d61[_0x6902('0x2f')]=_[_0x6902('0x30')](_0x5b8d61['model'],_0x5b8d61[_0x6902('0x2d')]);_0xe25c38[_0x6902('0x31')]=_[_0x6902('0x30')](_0x5b8d61['model'],qs[_0x6902('0x32')](_0x423534[_0x6902('0x2d')]['fields']));_0xe25c38['attributes']=_0xe25c38[_0x6902('0x31')][_0x6902('0x33')]?_0xe25c38[_0x6902('0x31')]:_0x5b8d61['model'];if(!_0x423534[_0x6902('0x2d')][_0x6902('0x34')]('nolimit')){_0xe25c38[_0x6902('0x1c')]=qs[_0x6902('0x1c')](_0x423534[_0x6902('0x2d')][_0x6902('0x1c')]);_0xe25c38[_0x6902('0x1b')]=qs[_0x6902('0x1b')](_0x423534['query'][_0x6902('0x1b')]);}_0xe25c38[_0x6902('0x35')]=qs[_0x6902('0x36')](_0x423534[_0x6902('0x2d')][_0x6902('0x36')]);_0xe25c38[_0x6902('0x37')]=qs[_0x6902('0x2f')](_[_0x6902('0x38')](_0x423534['query'],_0x5b8d61[_0x6902('0x2f')]),_0x24d958);if(_0x423534[_0x6902('0x2d')][_0x6902('0x39')]){_0xe25c38['where']=_[_0x6902('0x3a')](_0xe25c38[_0x6902('0x37')],{'$or':_[_0x6902('0x28')](_0x24d958,function(_0x47c31b){if(_0x47c31b[_0x6902('0x3b')]!=='VIRTUAL'){var _0x587e8e={};_0x587e8e[_0x47c31b[_0x6902('0x25')]]={'$like':'%'+_0x423534['query'][_0x6902('0x39')]+'%'};return _0x587e8e;}})});}_0xe25c38=_['merge']({},_0xe25c38,_0x423534[_0x6902('0x3c')]);var _0x10c0bc={'where':_0xe25c38['where']};return db['OpenchannelApplication'][_0x6902('0x1a')](_0x10c0bc)['then'](function(_0x23e845){_0x33eab1[_0x6902('0x1a')]=_0x23e845;if(_0x423534[_0x6902('0x2d')]['includeAll']){_0xe25c38[_0x6902('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x6902('0x3e')](_0xe25c38);})['then'](function(_0x3f1bbf){_0x33eab1[_0x6902('0x3f')]=_0x3f1bbf;return _0x33eab1;})['then'](respondWithFilteredResult(_0x1ccaad,_0xe25c38))[_0x6902('0x40')](handleError(_0x1ccaad,null));};exports['show']=function(_0x18495d,_0x43d3f5){var _0x47565b={'raw':!![],'where':{'id':_0x18495d[_0x6902('0x41')]['id']}},_0x131d83={};_0x131d83[_0x6902('0x42')]=_[_0x6902('0x2e')](db[_0x6902('0x29')][_0x6902('0x2a')]);_0x131d83[_0x6902('0x2d')]=_[_0x6902('0x2e')](_0x18495d['query']);_0x131d83['filters']=_[_0x6902('0x30')](_0x131d83[_0x6902('0x42')],_0x131d83['query']);_0x47565b[_0x6902('0x31')]=_[_0x6902('0x30')](_0x131d83[_0x6902('0x42')],qs[_0x6902('0x32')](_0x18495d[_0x6902('0x2d')][_0x6902('0x32')]));_0x47565b[_0x6902('0x31')]=_0x47565b[_0x6902('0x31')]['length']?_0x47565b[_0x6902('0x31')]:_0x131d83[_0x6902('0x42')];if(_0x18495d[_0x6902('0x2d')]['includeAll']){_0x47565b['include']=[{'all':!![]}];}_0x47565b=_[_0x6902('0x3a')]({},_0x47565b,_0x18495d[_0x6902('0x3c')]);return db[_0x6902('0x29')][_0x6902('0x43')](_0x47565b)[_0x6902('0x22')](handleEntityNotFound(_0x43d3f5,null))[_0x6902('0x22')](respondWithResult(_0x43d3f5,null))[_0x6902('0x40')](handleError(_0x43d3f5,null));};exports[_0x6902('0x44')]=function(_0x1202d0,_0xc4750c){return db[_0x6902('0x29')]['create'](_0x1202d0[_0x6902('0x45')],{})[_0x6902('0x22')](respondWithResult(_0xc4750c,0xc9))[_0x6902('0x40')](handleError(_0xc4750c,null));};exports[_0x6902('0x20')]=function(_0x18ec42,_0x1024a8){if(_0x18ec42[_0x6902('0x45')]['id']){delete _0x18ec42['body']['id'];}return db['OpenchannelApplication'][_0x6902('0x43')]({'where':{'id':_0x18ec42[_0x6902('0x41')]['id']}})['then'](handleEntityNotFound(_0x1024a8,null))[_0x6902('0x22')](saveUpdates(_0x18ec42[_0x6902('0x45')],null))[_0x6902('0x22')](respondWithResult(_0x1024a8,null))[_0x6902('0x40')](handleError(_0x1024a8,null));};exports['destroy']=function(_0x3a0b84,_0x160e0b){return db[_0x6902('0x29')][_0x6902('0x43')]({'where':{'id':_0x3a0b84[_0x6902('0x41')]['id']}})['then'](handleEntityNotFound(_0x160e0b,null))['then'](removeEntity(_0x160e0b,null))['catch'](handleError(_0x160e0b,null));};
\ No newline at end of file
+var _0xf17b=['model','fields','attributes','sort','where','filters','pick','filter','merge','type','options','OpenchannelApplication','includeAll','catch','params','rawAttributes','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','key','query','keys','intersection'];(function(_0x38697a,_0x2af2f2){var _0x2995e3=function(_0x1a7de0){while(--_0x1a7de0){_0x38697a['push'](_0x38697a['shift']());}};_0x2995e3(++_0x2af2f2);}(_0xf17b,0x12d));var _0xbf17=function(_0x334619,_0x4d049e){_0x334619=_0x334619-0x0;var _0x174dea=_0xf17b[_0x334619];return _0x174dea;};'use strict';var emlformat=require(_0xbf17('0x0'));var rimraf=require(_0xbf17('0x1'));var zipdir=require(_0xbf17('0x2'));var jsonpatch=require(_0xbf17('0x3'));var rp=require(_0xbf17('0x4'));var moment=require(_0xbf17('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf17('0x6'));var path=require(_0xbf17('0x7'));var sox=require('sox');var csv=require(_0xbf17('0x8'));var ejs=require(_0xbf17('0x9'));var fs=require('fs');var fs_extra=require(_0xbf17('0xa'));var _=require(_0xbf17('0xb'));var squel=require(_0xbf17('0xc'));var crypto=require(_0xbf17('0xd'));var jsforce=require(_0xbf17('0xe'));var deskjs=require(_0xbf17('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbf17('0x10'));var Papa=require(_0xbf17('0x11'));var Redis=require(_0xbf17('0x12'));var authService=require(_0xbf17('0x13'));var qs=require(_0xbf17('0x14'));var as=require(_0xbf17('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf17('0x16'))('api');var utils=require(_0xbf17('0x17'));var config=require(_0xbf17('0x18'));var licenseUtil=require(_0xbf17('0x19'));var db=require(_0xbf17('0x1a'))['db'];function respondWithStatusCode(_0x4a06a9,_0x3e2b29){_0x3e2b29=_0x3e2b29||0xcc;return function(_0x540b37){if(_0x540b37){return _0x4a06a9['sendStatus'](_0x3e2b29);}return _0x4a06a9[_0xbf17('0x1b')](_0x3e2b29)['end']();};}function respondWithResult(_0x388cf2,_0x13bdb5){_0x13bdb5=_0x13bdb5||0xc8;return function(_0x561b65){if(_0x561b65){return _0x388cf2[_0xbf17('0x1b')](_0x13bdb5)[_0xbf17('0x1c')](_0x561b65);}};}function respondWithFilteredResult(_0x222835,_0x5ce313){return function(_0x3a3090){if(_0x3a3090){var _0x2edc60=typeof _0x5ce313[_0xbf17('0x1d')]==='undefined'&&typeof _0x5ce313[_0xbf17('0x1e')]==='undefined';var _0x1a3a1b=_0x3a3090[_0xbf17('0x1f')];var _0x55ba24=_0x2edc60?0x0:_0x5ce313['offset'];var _0x5b7591=_0x2edc60?_0x3a3090['count']:_0x5ce313['offset']+_0x5ce313[_0xbf17('0x1e')];var _0x478904;if(_0x5b7591>=_0x1a3a1b){_0x5b7591=_0x1a3a1b;_0x478904=0xc8;}else{_0x478904=0xce;}_0x222835['status'](_0x478904);return _0x222835[_0xbf17('0x20')](_0xbf17('0x21'),_0x55ba24+'-'+_0x5b7591+'/'+_0x1a3a1b)[_0xbf17('0x1c')](_0x3a3090);}return null;};}function patchUpdates(_0x3a4cb1){return function(_0x3d7dda){try{jsonpatch['apply'](_0x3d7dda,_0x3a4cb1,!![]);}catch(_0x44fa09){return BPromise[_0xbf17('0x22')](_0x44fa09);}return _0x3d7dda['save']();};}function saveUpdates(_0x26794c,_0x41196c){return function(_0x188d0c){if(_0x188d0c){return _0x188d0c[_0xbf17('0x23')](_0x26794c)[_0xbf17('0x24')](function(_0x2bb9cf){return _0x2bb9cf;});}return null;};}function removeEntity(_0x5e1b7b,_0x1691d7){return function(_0x22c097){if(_0x22c097){return _0x22c097[_0xbf17('0x25')]()['then'](function(){_0x5e1b7b[_0xbf17('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf845,_0x15e43f){return function(_0x135d29){if(!_0x135d29){_0x4cf845[_0xbf17('0x26')](0x194);}return _0x135d29;};}function handleError(_0x3bbd29,_0x5add7a){_0x5add7a=_0x5add7a||0x1f4;return function(_0x57614f){logger[_0xbf17('0x27')](_0x57614f[_0xbf17('0x28')]);if(_0x57614f[_0xbf17('0x29')]){delete _0x57614f[_0xbf17('0x29')];}_0x3bbd29[_0xbf17('0x1b')](_0x5add7a)[_0xbf17('0x2a')](_0x57614f);};}exports[_0xbf17('0x2b')]=function(_0x4d3146,_0x260196){var _0x16470c={},_0x514f12={},_0x5b315f={'count':0x0,'rows':[]};var _0x4f28d5=_[_0xbf17('0x2c')](db['OpenchannelApplication']['rawAttributes'],function(_0x28e219){return{'name':_0x28e219['fieldName'],'type':_0x28e219['type'][_0xbf17('0x2d')]};});_0x514f12['model']=_['map'](_0x4f28d5,_0xbf17('0x29'));_0x514f12[_0xbf17('0x2e')]=_[_0xbf17('0x2f')](_0x4d3146[_0xbf17('0x2e')]);_0x514f12['filters']=_[_0xbf17('0x30')](_0x514f12[_0xbf17('0x31')],_0x514f12[_0xbf17('0x2e')]);_0x16470c['attributes']=_['intersection'](_0x514f12[_0xbf17('0x31')],qs[_0xbf17('0x32')](_0x4d3146[_0xbf17('0x2e')]['fields']));_0x16470c[_0xbf17('0x33')]=_0x16470c['attributes']['length']?_0x16470c['attributes']:_0x514f12[_0xbf17('0x31')];if(!_0x4d3146['query']['hasOwnProperty']('nolimit')){_0x16470c[_0xbf17('0x1e')]=qs[_0xbf17('0x1e')](_0x4d3146[_0xbf17('0x2e')][_0xbf17('0x1e')]);_0x16470c[_0xbf17('0x1d')]=qs[_0xbf17('0x1d')](_0x4d3146[_0xbf17('0x2e')]['offset']);}_0x16470c['order']=qs[_0xbf17('0x34')](_0x4d3146[_0xbf17('0x2e')][_0xbf17('0x34')]);_0x16470c[_0xbf17('0x35')]=qs[_0xbf17('0x36')](_[_0xbf17('0x37')](_0x4d3146['query'],_0x514f12['filters']),_0x4f28d5);if(_0x4d3146[_0xbf17('0x2e')][_0xbf17('0x38')]){_0x16470c[_0xbf17('0x35')]=_[_0xbf17('0x39')](_0x16470c['where'],{'$or':_[_0xbf17('0x2c')](_0x4f28d5,function(_0xeb804f){if(_0xeb804f[_0xbf17('0x3a')]!=='VIRTUAL'){var _0x50c2b5={};_0x50c2b5[_0xeb804f[_0xbf17('0x29')]]={'$like':'%'+_0x4d3146['query'][_0xbf17('0x38')]+'%'};return _0x50c2b5;}})});}_0x16470c=_[_0xbf17('0x39')]({},_0x16470c,_0x4d3146[_0xbf17('0x3b')]);var _0x371e3d={'where':_0x16470c[_0xbf17('0x35')]};return db[_0xbf17('0x3c')]['count'](_0x371e3d)['then'](function(_0x2c35a8){_0x5b315f[_0xbf17('0x1f')]=_0x2c35a8;if(_0x4d3146[_0xbf17('0x2e')][_0xbf17('0x3d')]){_0x16470c['include']=[{'all':!![]}];}return db[_0xbf17('0x3c')]['findAll'](_0x16470c);})['then'](function(_0xe8f720){_0x5b315f['rows']=_0xe8f720;return _0x5b315f;})['then'](respondWithFilteredResult(_0x260196,_0x16470c))[_0xbf17('0x3e')](handleError(_0x260196,null));};exports['show']=function(_0x5b7382,_0x1cb177){var _0xba438c={'raw':!![],'where':{'id':_0x5b7382[_0xbf17('0x3f')]['id']}},_0x4520bf={};_0x4520bf[_0xbf17('0x31')]=_[_0xbf17('0x2f')](db[_0xbf17('0x3c')][_0xbf17('0x40')]);_0x4520bf['query']=_[_0xbf17('0x2f')](_0x5b7382[_0xbf17('0x2e')]);_0x4520bf[_0xbf17('0x36')]=_['intersection'](_0x4520bf[_0xbf17('0x31')],_0x4520bf[_0xbf17('0x2e')]);_0xba438c[_0xbf17('0x33')]=_[_0xbf17('0x30')](_0x4520bf['model'],qs[_0xbf17('0x32')](_0x5b7382['query'][_0xbf17('0x32')]));_0xba438c[_0xbf17('0x33')]=_0xba438c[_0xbf17('0x33')][_0xbf17('0x41')]?_0xba438c[_0xbf17('0x33')]:_0x4520bf[_0xbf17('0x31')];if(_0x5b7382[_0xbf17('0x2e')]['includeAll']){_0xba438c[_0xbf17('0x42')]=[{'all':!![]}];}_0xba438c=_[_0xbf17('0x39')]({},_0xba438c,_0x5b7382[_0xbf17('0x3b')]);return db[_0xbf17('0x3c')][_0xbf17('0x43')](_0xba438c)[_0xbf17('0x24')](handleEntityNotFound(_0x1cb177,null))[_0xbf17('0x24')](respondWithResult(_0x1cb177,null))[_0xbf17('0x3e')](handleError(_0x1cb177,null));};exports[_0xbf17('0x44')]=function(_0x42e8f0,_0x1c0fe7){return db[_0xbf17('0x3c')][_0xbf17('0x44')](_0x42e8f0[_0xbf17('0x45')],{})[_0xbf17('0x24')](respondWithResult(_0x1c0fe7,0xc9))[_0xbf17('0x3e')](handleError(_0x1c0fe7,null));};exports[_0xbf17('0x23')]=function(_0x3a6af1,_0x9c632d){if(_0x3a6af1[_0xbf17('0x45')]['id']){delete _0x3a6af1['body']['id'];}return db[_0xbf17('0x3c')][_0xbf17('0x43')]({'where':{'id':_0x3a6af1['params']['id']}})[_0xbf17('0x24')](handleEntityNotFound(_0x9c632d,null))['then'](saveUpdates(_0x3a6af1[_0xbf17('0x45')],null))[_0xbf17('0x24')](respondWithResult(_0x9c632d,null))['catch'](handleError(_0x9c632d,null));};exports[_0xbf17('0x25')]=function(_0x15b57a,_0x3b1535){return db[_0xbf17('0x3c')][_0xbf17('0x43')]({'where':{'id':_0x15b57a[_0xbf17('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b1535,null))[_0xbf17('0x24')](removeEntity(_0x3b1535,null))[_0xbf17('0x3e')](handleError(_0x3b1535,null));};
\ No newline at end of file