Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / server / api / openchannelApplication / openchannelApplication.controller.js
index e0054e4..f7c41f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x913f=['sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','include','find','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x468134,_0x1063f3){var _0x458c3a=function(_0x43a374){while(--_0x43a374){_0x468134['push'](_0x468134['shift']());}};_0x458c3a(++_0x1063f3);}(_0x913f,0xaa));var _0xf913=function(_0x2ca856,_0xffe5fb){_0x2ca856=_0x2ca856-0x0;var _0x46ae6f=_0x913f[_0x2ca856];return _0x46ae6f;};'use strict';var pdf=require(_0xf913('0x0'));var emlformat=require(_0xf913('0x1'));var rimraf=require(_0xf913('0x2'));var zipdir=require(_0xf913('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf913('0x4'));var moment=require(_0xf913('0x5'));var BPromise=require(_0xf913('0x6'));var Mustache=require(_0xf913('0x7'));var util=require(_0xf913('0x8'));var path=require(_0xf913('0x9'));var sox=require(_0xf913('0xa'));var csv=require(_0xf913('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf913('0xc'));var jsforce=require(_0xf913('0xd'));var deskjs=require(_0xf913('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf913('0xf'));var Papa=require('papaparse');var Redis=require(_0xf913('0x10'));var authService=require(_0xf913('0x11'));var qs=require(_0xf913('0x12'));var as=require(_0xf913('0x13'));var hardwareService=require(_0xf913('0x14'));var logger=require('../../config/logger')(_0xf913('0x15'));var utils=require(_0xf913('0x16'));var config=require(_0xf913('0x17'));var db=require(_0xf913('0x18'))['db'];function respondWithStatusCode(_0x1ed082,_0x59a0c1){_0x59a0c1=_0x59a0c1||0xcc;return function(_0x24775e){if(_0x24775e){return _0x1ed082[_0xf913('0x19')](_0x59a0c1);}return _0x1ed082[_0xf913('0x1a')](_0x59a0c1)[_0xf913('0x1b')]();};}function respondWithResult(_0x1926b9,_0x29104b){_0x29104b=_0x29104b||0xc8;return function(_0x3e849b){if(_0x3e849b){return _0x1926b9[_0xf913('0x1a')](_0x29104b)['json'](_0x3e849b);}};}function respondWithFilteredResult(_0x574fc0,_0x384254){return function(_0x5a6717){if(_0x5a6717){var _0x121e52=_0x5a6717[_0xf913('0x1c')],_0x376ee5=_0x384254[_0xf913('0x1d')],_0x45dae3=_0x384254[_0xf913('0x1d')]+_0x384254[_0xf913('0x1e')],_0x4432cd;if(_0x45dae3>=_0x121e52){_0x45dae3=_0x121e52;_0x4432cd=0xc8;}else{_0x4432cd=0xce;}_0x574fc0[_0xf913('0x1a')](_0x4432cd);return _0x574fc0[_0xf913('0x1f')](_0xf913('0x20'),_0x376ee5+'-'+_0x45dae3+'/'+_0x121e52)[_0xf913('0x21')](_0x5a6717);}return null;};}function patchUpdates(_0x573d25){return function(_0x3bccbc){try{jsonpatch[_0xf913('0x22')](_0x3bccbc,_0x573d25,!![]);}catch(_0x5097dd){return BPromise[_0xf913('0x23')](_0x5097dd);}return _0x3bccbc[_0xf913('0x24')]();};}function saveUpdates(_0x14db7f,_0x3b38d1){return function(_0x5b7353){if(_0x5b7353){return _0x5b7353[_0xf913('0x25')](_0x14db7f)[_0xf913('0x26')](function(_0x587727){return _0x587727;});}return null;};}function removeEntity(_0x2d5c1f,_0x3f3611){return function(_0xdbce0a){if(_0xdbce0a){return _0xdbce0a['destroy']()['then'](function(){_0x2d5c1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59ac2c,_0x4148af){return function(_0x2028f4){if(!_0x2028f4){_0x59ac2c[_0xf913('0x19')](0x194);}return _0x2028f4;};}function handleError(_0x64af6e,_0x221a54){_0x221a54=_0x221a54||0x1f4;return function(_0x3a8761){logger[_0xf913('0x27')](_0x3a8761[_0xf913('0x28')]);if(_0x3a8761[_0xf913('0x29')]){delete _0x3a8761['name'];}_0x64af6e[_0xf913('0x1a')](_0x221a54)[_0xf913('0x2a')](_0x3a8761);};}exports['index']=function(_0x1e11c4,_0x2a9a53){var _0x5dfef6={},_0x9e9af9={},_0x3d54a7={'count':0x0,'rows':[]};var _0x3edfd2=_['map'](db[_0xf913('0x2b')][_0xf913('0x2c')],function(_0x26bf85){return{'name':_0x26bf85[_0xf913('0x2d')],'type':_0x26bf85[_0xf913('0x2e')][_0xf913('0x2f')]};});_0x9e9af9[_0xf913('0x30')]=_[_0xf913('0x31')](_0x3edfd2,_0xf913('0x29'));_0x9e9af9[_0xf913('0x32')]=_['keys'](_0x1e11c4[_0xf913('0x32')]);_0x9e9af9['filters']=_[_0xf913('0x33')](_0x9e9af9['model'],_0x9e9af9[_0xf913('0x32')]);_0x5dfef6[_0xf913('0x34')]=_[_0xf913('0x33')](_0x9e9af9[_0xf913('0x30')],qs[_0xf913('0x35')](_0x1e11c4['query'][_0xf913('0x35')]));_0x5dfef6[_0xf913('0x34')]=_0x5dfef6['attributes'][_0xf913('0x36')]?_0x5dfef6[_0xf913('0x34')]:_0x9e9af9['model'];if(!_0x1e11c4[_0xf913('0x32')][_0xf913('0x37')](_0xf913('0x38'))){_0x5dfef6['limit']=qs[_0xf913('0x1e')](_0x1e11c4['query']['limit']);_0x5dfef6[_0xf913('0x1d')]=qs['offset'](_0x1e11c4[_0xf913('0x32')]['offset']);}_0x5dfef6[_0xf913('0x39')]=qs[_0xf913('0x3a')](_0x1e11c4[_0xf913('0x32')][_0xf913('0x3a')]);_0x5dfef6[_0xf913('0x3b')]=qs['filters'](_[_0xf913('0x3c')](_0x1e11c4[_0xf913('0x32')],_0x9e9af9[_0xf913('0x3d')]));if(_0x1e11c4['query'][_0xf913('0x3e')]){_0x5dfef6[_0xf913('0x3b')]=_[_0xf913('0x3f')](_0x5dfef6[_0xf913('0x3b')],{'$or':_['map'](_0x3edfd2,function(_0xaa4d5e){if(_0xaa4d5e[_0xf913('0x2e')]!==_0xf913('0x40')){var _0x2caf8={};_0x2caf8[_0xaa4d5e[_0xf913('0x29')]]={'$like':'%'+_0x1e11c4[_0xf913('0x32')]['filter']+'%'};return _0x2caf8;}})});}_0x5dfef6=_['merge']({},_0x5dfef6,_0x1e11c4[_0xf913('0x41')]);var _0x2d08ec={'where':_0x5dfef6[_0xf913('0x3b')]};return db['OpenchannelApplication'][_0xf913('0x1c')](_0x2d08ec)[_0xf913('0x26')](function(_0x62dbc7){_0x3d54a7[_0xf913('0x1c')]=_0x62dbc7;if(_0x1e11c4['query'][_0xf913('0x42')]){_0x5dfef6['include']=[{'all':!![]}];}return db[_0xf913('0x2b')][_0xf913('0x43')](_0x5dfef6);})[_0xf913('0x26')](function(_0xbb60e4){_0x3d54a7['rows']=_0xbb60e4;return _0x3d54a7;})['then'](respondWithFilteredResult(_0x2a9a53,_0x5dfef6))['catch'](handleError(_0x2a9a53,null));};exports[_0xf913('0x44')]=function(_0x52a110,_0x5cf6de){var _0x5426ef={'raw':!![],'where':{'id':_0x52a110[_0xf913('0x45')]['id']}},_0x43fe54={};_0x43fe54['model']=_[_0xf913('0x46')](db['OpenchannelApplication']['rawAttributes']);_0x43fe54[_0xf913('0x32')]=_['keys'](_0x52a110[_0xf913('0x32')]);_0x43fe54[_0xf913('0x3d')]=_[_0xf913('0x33')](_0x43fe54[_0xf913('0x30')],_0x43fe54[_0xf913('0x32')]);_0x5426ef[_0xf913('0x34')]=_['intersection'](_0x43fe54['model'],qs[_0xf913('0x35')](_0x52a110['query'][_0xf913('0x35')]));_0x5426ef['attributes']=_0x5426ef['attributes'][_0xf913('0x36')]?_0x5426ef[_0xf913('0x34')]:_0x43fe54[_0xf913('0x30')];if(_0x52a110['query']['includeAll']){_0x5426ef[_0xf913('0x47')]=[{'all':!![]}];}_0x5426ef=_[_0xf913('0x3f')]({},_0x5426ef,_0x52a110[_0xf913('0x41')]);return db[_0xf913('0x2b')][_0xf913('0x48')](_0x5426ef)[_0xf913('0x26')](handleEntityNotFound(_0x5cf6de,null))['then'](respondWithResult(_0x5cf6de,null))['catch'](handleError(_0x5cf6de,null));};exports[_0xf913('0x49')]=function(_0x449bf5,_0x4dfdf9){return db['OpenchannelApplication'][_0xf913('0x49')](_0x449bf5[_0xf913('0x4a')],{})[_0xf913('0x26')](respondWithResult(_0x4dfdf9,0xc9))['catch'](handleError(_0x4dfdf9,null));};exports['update']=function(_0x21c2e2,_0xbeb005){if(_0x21c2e2[_0xf913('0x4a')]['id']){delete _0x21c2e2[_0xf913('0x4a')]['id'];}return db['OpenchannelApplication'][_0xf913('0x48')]({'where':{'id':_0x21c2e2['params']['id']}})[_0xf913('0x26')](handleEntityNotFound(_0xbeb005,null))[_0xf913('0x26')](saveUpdates(_0x21c2e2[_0xf913('0x4a')],null))[_0xf913('0x26')](respondWithResult(_0xbeb005,null))[_0xf913('0x4b')](handleError(_0xbeb005,null));};exports['destroy']=function(_0x570a7c,_0xd9d136){return db[_0xf913('0x2b')][_0xf913('0x48')]({'where':{'id':_0x570a7c['params']['id']}})[_0xf913('0x26')](handleEntityNotFound(_0xd9d136,null))[_0xf913('0x26')](removeEntity(_0xd9d136,null))['catch'](handleError(_0xd9d136,null));};
\ No newline at end of file
+var _0x9202=['fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x1f41b4,_0x2a3899){var _0x131b99=function(_0x3949cc){while(--_0x3949cc){_0x1f41b4['push'](_0x1f41b4['shift']());}};_0x131b99(++_0x2a3899);}(_0x9202,0x130));var _0x2920=function(_0x5103e9,_0x420916){_0x5103e9=_0x5103e9-0x0;var _0x3bf4aa=_0x9202[_0x5103e9];return _0x3bf4aa;};'use strict';var emlformat=require(_0x2920('0x0'));var rimraf=require(_0x2920('0x1'));var zipdir=require(_0x2920('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2920('0x3'));var BPromise=require(_0x2920('0x4'));var Mustache=require(_0x2920('0x5'));var util=require(_0x2920('0x6'));var path=require(_0x2920('0x7'));var sox=require(_0x2920('0x8'));var csv=require(_0x2920('0x9'));var ejs=require(_0x2920('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2920('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2920('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2920('0x9'));var querystring=require(_0x2920('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2920('0xe'));var hardwareService=require(_0x2920('0xf'));var logger=require(_0x2920('0x10'))(_0x2920('0x11'));var utils=require('../../config/utils');var config=require(_0x2920('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2920('0x13'))['db'];function respondWithStatusCode(_0x171827,_0x23db17){_0x23db17=_0x23db17||0xcc;return function(_0x214984){if(_0x214984){return _0x171827['sendStatus'](_0x23db17);}return _0x171827[_0x2920('0x14')](_0x23db17)[_0x2920('0x15')]();};}function respondWithResult(_0x2c5e49,_0x1e4d2d){_0x1e4d2d=_0x1e4d2d||0xc8;return function(_0x14ddbf){if(_0x14ddbf){return _0x2c5e49['status'](_0x1e4d2d)[_0x2920('0x16')](_0x14ddbf);}};}function respondWithFilteredResult(_0x130dbc,_0x1c931f){return function(_0x3d10f4){if(_0x3d10f4){var _0x59ac00=typeof _0x1c931f[_0x2920('0x17')]===_0x2920('0x18')&&typeof _0x1c931f[_0x2920('0x19')]===_0x2920('0x18');var _0x771b42=_0x3d10f4[_0x2920('0x1a')];var _0x371568=_0x59ac00?0x0:_0x1c931f[_0x2920('0x17')];var _0x4979d8=_0x59ac00?_0x3d10f4['count']:_0x1c931f[_0x2920('0x17')]+_0x1c931f[_0x2920('0x19')];var _0x226584;if(_0x4979d8>=_0x771b42){_0x4979d8=_0x771b42;_0x226584=0xc8;}else{_0x226584=0xce;}_0x130dbc[_0x2920('0x14')](_0x226584);return _0x130dbc['set'](_0x2920('0x1b'),_0x371568+'-'+_0x4979d8+'/'+_0x771b42)[_0x2920('0x16')](_0x3d10f4);}return null;};}function patchUpdates(_0x1c630d){return function(_0x252e54){try{jsonpatch[_0x2920('0x1c')](_0x252e54,_0x1c630d,!![]);}catch(_0x3d3728){return BPromise[_0x2920('0x1d')](_0x3d3728);}return _0x252e54[_0x2920('0x1e')]();};}function saveUpdates(_0x1247d4,_0x499395){return function(_0x57a670){if(_0x57a670){return _0x57a670[_0x2920('0x1f')](_0x1247d4)[_0x2920('0x20')](function(_0x4d7fa6){return _0x4d7fa6;});}return null;};}function removeEntity(_0x239779,_0x455ff1){return function(_0x372391){if(_0x372391){return _0x372391[_0x2920('0x21')]()[_0x2920('0x20')](function(){_0x239779[_0x2920('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x131511,_0x5b3302){return function(_0x463000){if(!_0x463000){_0x131511[_0x2920('0x22')](0x194);}return _0x463000;};}function handleError(_0x1224b6,_0x5784a3){_0x5784a3=_0x5784a3||0x1f4;return function(_0x23fbaf){logger[_0x2920('0x23')](_0x23fbaf[_0x2920('0x24')]);if(_0x23fbaf[_0x2920('0x25')]){delete _0x23fbaf[_0x2920('0x25')];}_0x1224b6['status'](_0x5784a3)[_0x2920('0x26')](_0x23fbaf);};}exports[_0x2920('0x27')]=function(_0x4391b9,_0x2b43f6){var _0x68e2b5={},_0x209e43={},_0x3b1f7b={'count':0x0,'rows':[]};var _0x57e642=_[_0x2920('0x28')](db[_0x2920('0x29')][_0x2920('0x2a')],function(_0x5f438){return{'name':_0x5f438['fieldName'],'type':_0x5f438[_0x2920('0x2b')][_0x2920('0x2c')]};});_0x209e43[_0x2920('0x2d')]=_[_0x2920('0x28')](_0x57e642,_0x2920('0x25'));_0x209e43[_0x2920('0x2e')]=_[_0x2920('0x2f')](_0x4391b9[_0x2920('0x2e')]);_0x209e43[_0x2920('0x30')]=_['intersection'](_0x209e43[_0x2920('0x2d')],_0x209e43[_0x2920('0x2e')]);_0x68e2b5[_0x2920('0x31')]=_[_0x2920('0x32')](_0x209e43[_0x2920('0x2d')],qs[_0x2920('0x33')](_0x4391b9[_0x2920('0x2e')]['fields']));_0x68e2b5[_0x2920('0x31')]=_0x68e2b5['attributes'][_0x2920('0x34')]?_0x68e2b5[_0x2920('0x31')]:_0x209e43[_0x2920('0x2d')];if(!_0x4391b9['query']['hasOwnProperty'](_0x2920('0x35'))){_0x68e2b5[_0x2920('0x19')]=qs[_0x2920('0x19')](_0x4391b9[_0x2920('0x2e')]['limit']);_0x68e2b5[_0x2920('0x17')]=qs[_0x2920('0x17')](_0x4391b9[_0x2920('0x2e')]['offset']);}_0x68e2b5[_0x2920('0x36')]=qs[_0x2920('0x37')](_0x4391b9[_0x2920('0x2e')][_0x2920('0x37')]);_0x68e2b5['where']=qs[_0x2920('0x30')](_[_0x2920('0x38')](_0x4391b9[_0x2920('0x2e')],_0x209e43['filters']),_0x57e642);if(_0x4391b9[_0x2920('0x2e')][_0x2920('0x39')]){_0x68e2b5[_0x2920('0x3a')]=_[_0x2920('0x3b')](_0x68e2b5[_0x2920('0x3a')],{'$or':_[_0x2920('0x28')](_0x57e642,function(_0x38b68b){if(_0x38b68b[_0x2920('0x2b')]!==_0x2920('0x3c')){var _0x59001d={};_0x59001d[_0x38b68b['name']]={'$like':'%'+_0x4391b9[_0x2920('0x2e')][_0x2920('0x39')]+'%'};return _0x59001d;}})});}_0x68e2b5=_[_0x2920('0x3b')]({},_0x68e2b5,_0x4391b9[_0x2920('0x3d')]);var _0xe04840={'where':_0x68e2b5[_0x2920('0x3a')]};return db[_0x2920('0x29')]['count'](_0xe04840)[_0x2920('0x20')](function(_0x316b87){_0x3b1f7b[_0x2920('0x1a')]=_0x316b87;if(_0x4391b9['query'][_0x2920('0x3e')]){_0x68e2b5[_0x2920('0x3f')]=[{'all':!![]}];}return db[_0x2920('0x29')][_0x2920('0x40')](_0x68e2b5);})[_0x2920('0x20')](function(_0x382705){_0x3b1f7b[_0x2920('0x41')]=_0x382705;return _0x3b1f7b;})[_0x2920('0x20')](respondWithFilteredResult(_0x2b43f6,_0x68e2b5))['catch'](handleError(_0x2b43f6,null));};exports['show']=function(_0x423527,_0x5ecd7e){var _0x2e4b60={'raw':!![],'where':{'id':_0x423527[_0x2920('0x42')]['id']}},_0x3ebef1={};_0x3ebef1['model']=_[_0x2920('0x2f')](db['OpenchannelApplication'][_0x2920('0x2a')]);_0x3ebef1[_0x2920('0x2e')]=_[_0x2920('0x2f')](_0x423527[_0x2920('0x2e')]);_0x3ebef1['filters']=_[_0x2920('0x32')](_0x3ebef1[_0x2920('0x2d')],_0x3ebef1[_0x2920('0x2e')]);_0x2e4b60[_0x2920('0x31')]=_[_0x2920('0x32')](_0x3ebef1[_0x2920('0x2d')],qs['fields'](_0x423527[_0x2920('0x2e')][_0x2920('0x33')]));_0x2e4b60['attributes']=_0x2e4b60['attributes'][_0x2920('0x34')]?_0x2e4b60[_0x2920('0x31')]:_0x3ebef1[_0x2920('0x2d')];if(_0x423527[_0x2920('0x2e')][_0x2920('0x3e')]){_0x2e4b60[_0x2920('0x3f')]=[{'all':!![]}];}_0x2e4b60=_['merge']({},_0x2e4b60,_0x423527[_0x2920('0x3d')]);return db[_0x2920('0x29')][_0x2920('0x43')](_0x2e4b60)['then'](handleEntityNotFound(_0x5ecd7e,null))[_0x2920('0x20')](respondWithResult(_0x5ecd7e,null))[_0x2920('0x44')](handleError(_0x5ecd7e,null));};exports[_0x2920('0x45')]=function(_0xdd59f4,_0x67dba4){return db[_0x2920('0x29')][_0x2920('0x45')](_0xdd59f4[_0x2920('0x46')],{})[_0x2920('0x20')](respondWithResult(_0x67dba4,0xc9))[_0x2920('0x44')](handleError(_0x67dba4,null));};exports[_0x2920('0x1f')]=function(_0x30c353,_0x5dd5eb){if(_0x30c353[_0x2920('0x46')]['id']){delete _0x30c353[_0x2920('0x46')]['id'];}return db[_0x2920('0x29')]['find']({'where':{'id':_0x30c353['params']['id']}})['then'](handleEntityNotFound(_0x5dd5eb,null))[_0x2920('0x20')](saveUpdates(_0x30c353['body'],null))[_0x2920('0x20')](respondWithResult(_0x5dd5eb,null))[_0x2920('0x44')](handleError(_0x5dd5eb,null));};exports[_0x2920('0x21')]=function(_0x5d3854,_0x42e1f5){return db[_0x2920('0x29')][_0x2920('0x43')]({'where':{'id':_0x5d3854['params']['id']}})[_0x2920('0x20')](handleEntityNotFound(_0x42e1f5,null))[_0x2920('0x20')](removeEntity(_0x42e1f5,null))[_0x2920('0x44')](handleError(_0x42e1f5,null));};
\ No newline at end of file