Built motion from commit 753c950e.|2.5.42
[motion2.git] / server / api / openchannelApplication / openchannelApplication.controller.js
index c247afb..6b9d601 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x955a=['then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','type','merge','includeAll','include','catch','show','keys','find','create','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save'];(function(_0x2a90ee,_0x5de498){var _0x2b722f=function(_0xae71db){while(--_0xae71db){_0x2a90ee['push'](_0x2a90ee['shift']());}};_0x2b722f(++_0x5de498);}(_0x955a,0x192));var _0xa955=function(_0x43fa11,_0x3f33cf){_0x43fa11=_0x43fa11-0x0;var _0x52fa03=_0x955a[_0x43fa11];return _0x52fa03;};'use strict';var pdf=require(_0xa955('0x0'));var emlformat=require(_0xa955('0x1'));var rimraf=require(_0xa955('0x2'));var zipdir=require(_0xa955('0x3'));var jsonpatch=require(_0xa955('0x4'));var rp=require(_0xa955('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa955('0x6'));var path=require(_0xa955('0x7'));var sox=require(_0xa955('0x8'));var csv=require(_0xa955('0x9'));var ejs=require(_0xa955('0xa'));var fs=require('fs');var _=require(_0xa955('0xb'));var squel=require(_0xa955('0xc'));var crypto=require('crypto');var jsforce=require(_0xa955('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa955('0x9'));var querystring=require(_0xa955('0xe'));var Papa=require(_0xa955('0xf'));var Redis=require(_0xa955('0x10'));var authService=require(_0xa955('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa955('0x12'));var hardwareService=require(_0xa955('0x13'));var logger=require(_0xa955('0x14'))(_0xa955('0x15'));var utils=require(_0xa955('0x16'));var config=require(_0xa955('0x17'));var db=require(_0xa955('0x18'))['db'];function respondWithStatusCode(_0x3ea9f4,_0x4e1154){_0x4e1154=_0x4e1154||0xcc;return function(_0x3a5919){if(_0x3a5919){return _0x3ea9f4[_0xa955('0x19')](_0x4e1154);}return _0x3ea9f4[_0xa955('0x1a')](_0x4e1154)[_0xa955('0x1b')]();};}function respondWithResult(_0x95a3de,_0x4ab64c){_0x4ab64c=_0x4ab64c||0xc8;return function(_0xf5040f){if(_0xf5040f){return _0x95a3de[_0xa955('0x1a')](_0x4ab64c)[_0xa955('0x1c')](_0xf5040f);}};}function respondWithFilteredResult(_0x5d2d39,_0x5a25dc){return function(_0x1bb181){if(_0x1bb181){var _0x19aca6=_0x1bb181[_0xa955('0x1d')],_0x12a91c=_0x5a25dc['offset'],_0x39d6bc=_0x5a25dc['offset']+_0x5a25dc[_0xa955('0x1e')],_0x2a0224;if(_0x39d6bc>=_0x19aca6){_0x39d6bc=_0x19aca6;_0x2a0224=0xc8;}else{_0x2a0224=0xce;}_0x5d2d39['status'](_0x2a0224);return _0x5d2d39[_0xa955('0x1f')](_0xa955('0x20'),_0x12a91c+'-'+_0x39d6bc+'/'+_0x19aca6)['json'](_0x1bb181);}return null;};}function patchUpdates(_0x7e26ee){return function(_0x23b9e5){try{jsonpatch[_0xa955('0x21')](_0x23b9e5,_0x7e26ee,!![]);}catch(_0x52f413){return BPromise[_0xa955('0x22')](_0x52f413);}return _0x23b9e5[_0xa955('0x23')]();};}function saveUpdates(_0x2724e3,_0x257fbd){return function(_0x1ef135){if(_0x1ef135){return _0x1ef135['update'](_0x2724e3)[_0xa955('0x24')](function(_0x472240){return _0x472240;});}return null;};}function removeEntity(_0x301864,_0x394f0d){return function(_0x1ee291){if(_0x1ee291){return _0x1ee291[_0xa955('0x25')]()[_0xa955('0x24')](function(){_0x301864[_0xa955('0x1a')](0xcc)[_0xa955('0x1b')]();});}};}function handleEntityNotFound(_0x5b94e5,_0x56da11){return function(_0x4c11f1){if(!_0x4c11f1){_0x5b94e5[_0xa955('0x19')](0x194);}return _0x4c11f1;};}function handleError(_0x4aca9d,_0x33a52b){_0x33a52b=_0x33a52b||0x1f4;return function(_0x3b04e1){logger['error'](_0x3b04e1[_0xa955('0x26')]);if(_0x3b04e1[_0xa955('0x27')]){delete _0x3b04e1[_0xa955('0x27')];}_0x4aca9d[_0xa955('0x1a')](_0x33a52b)[_0xa955('0x28')](_0x3b04e1);};}exports[_0xa955('0x29')]=function(_0x4b5a87,_0x3af2bb){var _0xe5396b={},_0xb5bc63={},_0x3f1796={'count':0x0,'rows':[]};var _0x3223c1=_[_0xa955('0x2a')](db[_0xa955('0x2b')][_0xa955('0x2c')],function(_0x186174){return{'name':_0x186174[_0xa955('0x2d')],'type':_0x186174['type'][_0xa955('0x2e')]};});_0xb5bc63[_0xa955('0x2f')]=_[_0xa955('0x2a')](_0x3223c1,_0xa955('0x27'));_0xb5bc63[_0xa955('0x30')]=_['keys'](_0x4b5a87[_0xa955('0x30')]);_0xb5bc63['filters']=_[_0xa955('0x31')](_0xb5bc63[_0xa955('0x2f')],_0xb5bc63[_0xa955('0x30')]);_0xe5396b[_0xa955('0x32')]=_['intersection'](_0xb5bc63['model'],qs[_0xa955('0x33')](_0x4b5a87[_0xa955('0x30')][_0xa955('0x33')]));_0xe5396b[_0xa955('0x32')]=_0xe5396b['attributes'][_0xa955('0x34')]?_0xe5396b[_0xa955('0x32')]:_0xb5bc63[_0xa955('0x2f')];if(!_0x4b5a87[_0xa955('0x30')][_0xa955('0x35')](_0xa955('0x36'))){_0xe5396b[_0xa955('0x1e')]=qs[_0xa955('0x1e')](_0x4b5a87[_0xa955('0x30')][_0xa955('0x1e')]);_0xe5396b[_0xa955('0x37')]=qs[_0xa955('0x37')](_0x4b5a87[_0xa955('0x30')][_0xa955('0x37')]);}_0xe5396b[_0xa955('0x38')]=qs[_0xa955('0x39')](_0x4b5a87[_0xa955('0x30')][_0xa955('0x39')]);_0xe5396b[_0xa955('0x3a')]=qs[_0xa955('0x3b')](_['pick'](_0x4b5a87[_0xa955('0x30')],_0xb5bc63[_0xa955('0x3b')]),_0x3223c1);if(_0x4b5a87[_0xa955('0x30')][_0xa955('0x3c')]){_0xe5396b['where']=_['merge'](_0xe5396b[_0xa955('0x3a')],{'$or':_[_0xa955('0x2a')](_0x3223c1,function(_0x37e853){if(_0x37e853[_0xa955('0x3d')]!=='VIRTUAL'){var _0x518184={};_0x518184[_0x37e853['name']]={'$like':'%'+_0x4b5a87['query']['filter']+'%'};return _0x518184;}})});}_0xe5396b=_[_0xa955('0x3e')]({},_0xe5396b,_0x4b5a87['options']);var _0x51f143={'where':_0xe5396b[_0xa955('0x3a')]};return db['OpenchannelApplication'][_0xa955('0x1d')](_0x51f143)['then'](function(_0x4ca9ab){_0x3f1796[_0xa955('0x1d')]=_0x4ca9ab;if(_0x4b5a87['query'][_0xa955('0x3f')]){_0xe5396b[_0xa955('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0xe5396b);})['then'](function(_0x2cadec){_0x3f1796['rows']=_0x2cadec;return _0x3f1796;})[_0xa955('0x24')](respondWithFilteredResult(_0x3af2bb,_0xe5396b))[_0xa955('0x41')](handleError(_0x3af2bb,null));};exports[_0xa955('0x42')]=function(_0x47f043,_0x488de0){var _0x2343c7={'raw':!![],'where':{'id':_0x47f043['params']['id']}},_0x3f67d3={};_0x3f67d3[_0xa955('0x2f')]=_[_0xa955('0x43')](db[_0xa955('0x2b')][_0xa955('0x2c')]);_0x3f67d3['query']=_[_0xa955('0x43')](_0x47f043[_0xa955('0x30')]);_0x3f67d3[_0xa955('0x3b')]=_['intersection'](_0x3f67d3[_0xa955('0x2f')],_0x3f67d3[_0xa955('0x30')]);_0x2343c7[_0xa955('0x32')]=_['intersection'](_0x3f67d3[_0xa955('0x2f')],qs['fields'](_0x47f043[_0xa955('0x30')][_0xa955('0x33')]));_0x2343c7[_0xa955('0x32')]=_0x2343c7[_0xa955('0x32')]['length']?_0x2343c7[_0xa955('0x32')]:_0x3f67d3[_0xa955('0x2f')];if(_0x47f043[_0xa955('0x30')][_0xa955('0x3f')]){_0x2343c7['include']=[{'all':!![]}];}_0x2343c7=_[_0xa955('0x3e')]({},_0x2343c7,_0x47f043['options']);return db[_0xa955('0x2b')][_0xa955('0x44')](_0x2343c7)[_0xa955('0x24')](handleEntityNotFound(_0x488de0,null))[_0xa955('0x24')](respondWithResult(_0x488de0,null))['catch'](handleError(_0x488de0,null));};exports['create']=function(_0x5a311a,_0x366cf3){return db[_0xa955('0x2b')][_0xa955('0x45')](_0x5a311a['body'],{})[_0xa955('0x24')](respondWithResult(_0x366cf3,0xc9))['catch'](handleError(_0x366cf3,null));};exports[_0xa955('0x46')]=function(_0x44f50c,_0x5bddb6){if(_0x44f50c[_0xa955('0x47')]['id']){delete _0x44f50c[_0xa955('0x47')]['id'];}return db['OpenchannelApplication'][_0xa955('0x44')]({'where':{'id':_0x44f50c[_0xa955('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bddb6,null))[_0xa955('0x24')](saveUpdates(_0x44f50c['body'],null))[_0xa955('0x24')](respondWithResult(_0x5bddb6,null))[_0xa955('0x41')](handleError(_0x5bddb6,null));};exports[_0xa955('0x25')]=function(_0x61ccc0,_0x3ab7c8){return db[_0xa955('0x2b')][_0xa955('0x44')]({'where':{'id':_0x61ccc0['params']['id']}})[_0xa955('0x24')](handleEntityNotFound(_0x3ab7c8,null))['then'](removeEntity(_0x3ab7c8,null))[_0xa955('0x41')](handleError(_0x3ab7c8,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