Built motion from commit 43538d75.|2.5.35
[motion2.git] / server / api / intZendeskField / intZendeskField.controller.js
index b671322..0af7871 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe30f=['Content-Range','json','apply','reject','save','update','end','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','find','then','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set'];(function(_0x105def,_0x17cc40){var _0x2e999d=function(_0x34791b){while(--_0x34791b){_0x105def['push'](_0x105def['shift']());}};_0x2e999d(++_0x17cc40);}(_0xe30f,0xc1));var _0xfe30=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe30f[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xfe30('0x0'));var rimraf=require(_0xfe30('0x1'));var zipdir=require(_0xfe30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe30('0x3'));var moment=require(_0xfe30('0x4'));var BPromise=require(_0xfe30('0x5'));var Mustache=require(_0xfe30('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfe30('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe30('0x8'));var _=require(_0xfe30('0x9'));var squel=require(_0xfe30('0xa'));var crypto=require(_0xfe30('0xb'));var jsforce=require(_0xfe30('0xc'));var deskjs=require(_0xfe30('0xd'));var toCsv=require(_0xfe30('0xe'));var querystring=require('querystring');var Papa=require(_0xfe30('0xf'));var Redis=require(_0xfe30('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfe30('0x11'));var as=require(_0xfe30('0x12'));var hardwareService=require(_0xfe30('0x13'));var logger=require(_0xfe30('0x14'))(_0xfe30('0x15'));var utils=require(_0xfe30('0x16'));var config=require(_0xfe30('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe30('0x18'))['db'];function respondWithStatusCode(_0x1c5297,_0x2ac692){_0x2ac692=_0x2ac692||0xcc;return function(_0x532928){if(_0x532928){return _0x1c5297[_0xfe30('0x19')](_0x2ac692);}return _0x1c5297[_0xfe30('0x1a')](_0x2ac692)['end']();};}function respondWithResult(_0x126091,_0x24cb93){_0x24cb93=_0x24cb93||0xc8;return function(_0x5bbfc0){if(_0x5bbfc0){return _0x126091['status'](_0x24cb93)['json'](_0x5bbfc0);}};}function respondWithFilteredResult(_0x574330,_0x4de93c){return function(_0x57554c){if(_0x57554c){var _0x3f4cbc=typeof _0x4de93c[_0xfe30('0x1b')]===_0xfe30('0x1c')&&typeof _0x4de93c['limit']===_0xfe30('0x1c');var _0x4c0133=_0x57554c['count'];var _0x1888b3=_0x3f4cbc?0x0:_0x4de93c['offset'];var _0xeec2c1=_0x3f4cbc?_0x57554c[_0xfe30('0x1d')]:_0x4de93c['offset']+_0x4de93c[_0xfe30('0x1e')];var _0x5b94f1;if(_0xeec2c1>=_0x4c0133){_0xeec2c1=_0x4c0133;_0x5b94f1=0xc8;}else{_0x5b94f1=0xce;}_0x574330[_0xfe30('0x1a')](_0x5b94f1);return _0x574330[_0xfe30('0x1f')](_0xfe30('0x20'),_0x1888b3+'-'+_0xeec2c1+'/'+_0x4c0133)[_0xfe30('0x21')](_0x57554c);}return null;};}function patchUpdates(_0x30e07a){return function(_0x50d3a2){try{jsonpatch[_0xfe30('0x22')](_0x50d3a2,_0x30e07a,!![]);}catch(_0x424044){return BPromise[_0xfe30('0x23')](_0x424044);}return _0x50d3a2[_0xfe30('0x24')]();};}function saveUpdates(_0x11d7a6,_0x3277d8){return function(_0x300ce3){if(_0x300ce3){return _0x300ce3[_0xfe30('0x25')](_0x11d7a6)['then'](function(_0x53e115){return _0x53e115;});}return null;};}function removeEntity(_0x3529c1,_0x1be4de){return function(_0x30a458){if(_0x30a458){return _0x30a458['destroy']()['then'](function(){_0x3529c1[_0xfe30('0x1a')](0xcc)[_0xfe30('0x26')]();});}};}function handleEntityNotFound(_0x1c937f,_0x3f51e5){return function(_0x326710){if(!_0x326710){_0x1c937f[_0xfe30('0x19')](0x194);}return _0x326710;};}function handleError(_0x1cb9d3,_0x373747){_0x373747=_0x373747||0x1f4;return function(_0xf77462){logger[_0xfe30('0x27')](_0xf77462[_0xfe30('0x28')]);if(_0xf77462[_0xfe30('0x29')]){delete _0xf77462[_0xfe30('0x29')];}_0x1cb9d3[_0xfe30('0x1a')](_0x373747)[_0xfe30('0x2a')](_0xf77462);};}exports['index']=function(_0x458973,_0xbec6ad){var _0x45752a={},_0x2537c3={},_0x3053cb={'count':0x0,'rows':[]};var _0x1c334b=_[_0xfe30('0x2b')](db[_0xfe30('0x2c')][_0xfe30('0x2d')],function(_0x9332a5){return{'name':_0x9332a5[_0xfe30('0x2e')],'type':_0x9332a5['type'][_0xfe30('0x2f')]};});_0x2537c3[_0xfe30('0x30')]=_[_0xfe30('0x2b')](_0x1c334b,'name');_0x2537c3['query']=_[_0xfe30('0x31')](_0x458973['query']);_0x2537c3[_0xfe30('0x32')]=_[_0xfe30('0x33')](_0x2537c3[_0xfe30('0x30')],_0x2537c3[_0xfe30('0x34')]);_0x45752a['attributes']=_[_0xfe30('0x33')](_0x2537c3[_0xfe30('0x30')],qs[_0xfe30('0x35')](_0x458973[_0xfe30('0x34')]['fields']));_0x45752a[_0xfe30('0x36')]=_0x45752a['attributes']['length']?_0x45752a[_0xfe30('0x36')]:_0x2537c3[_0xfe30('0x30')];if(!_0x458973[_0xfe30('0x34')]['hasOwnProperty'](_0xfe30('0x37'))){_0x45752a[_0xfe30('0x1e')]=qs[_0xfe30('0x1e')](_0x458973[_0xfe30('0x34')][_0xfe30('0x1e')]);_0x45752a[_0xfe30('0x1b')]=qs[_0xfe30('0x1b')](_0x458973[_0xfe30('0x34')][_0xfe30('0x1b')]);}_0x45752a[_0xfe30('0x38')]=qs['sort'](_0x458973[_0xfe30('0x34')][_0xfe30('0x39')]);_0x45752a[_0xfe30('0x3a')]=qs[_0xfe30('0x32')](_[_0xfe30('0x3b')](_0x458973[_0xfe30('0x34')],_0x2537c3['filters']),_0x1c334b);if(_0x458973[_0xfe30('0x34')]['filter']){_0x45752a[_0xfe30('0x3a')]=_[_0xfe30('0x3c')](_0x45752a[_0xfe30('0x3a')],{'$or':_['map'](_0x1c334b,function(_0x2cb772){if(_0x2cb772[_0xfe30('0x3d')]!=='VIRTUAL'){var _0x2f7e25={};_0x2f7e25[_0x2cb772['name']]={'$like':'%'+_0x458973[_0xfe30('0x34')][_0xfe30('0x3e')]+'%'};return _0x2f7e25;}})});}_0x45752a=_[_0xfe30('0x3c')]({},_0x45752a,_0x458973[_0xfe30('0x3f')]);var _0x404501={'where':_0x45752a[_0xfe30('0x3a')]};return db[_0xfe30('0x2c')][_0xfe30('0x1d')](_0x404501)['then'](function(_0x1c21e6){_0x3053cb[_0xfe30('0x1d')]=_0x1c21e6;if(_0x458973[_0xfe30('0x34')][_0xfe30('0x40')]){_0x45752a[_0xfe30('0x41')]=[{'all':!![]}];}return db['ZendeskField'][_0xfe30('0x42')](_0x45752a);})['then'](function(_0xac0c08){_0x3053cb[_0xfe30('0x43')]=_0xac0c08;return _0x3053cb;})['then'](respondWithFilteredResult(_0xbec6ad,_0x45752a))[_0xfe30('0x44')](handleError(_0xbec6ad,null));};exports['show']=function(_0x3dcd4e,_0x508614){var _0x2f9691={'raw':!![],'where':{'id':_0x3dcd4e[_0xfe30('0x45')]['id']}},_0x174dfa={};_0x174dfa[_0xfe30('0x30')]=_[_0xfe30('0x31')](db['ZendeskField'][_0xfe30('0x2d')]);_0x174dfa[_0xfe30('0x34')]=_['keys'](_0x3dcd4e['query']);_0x174dfa['filters']=_[_0xfe30('0x33')](_0x174dfa['model'],_0x174dfa[_0xfe30('0x34')]);_0x2f9691[_0xfe30('0x36')]=_[_0xfe30('0x33')](_0x174dfa[_0xfe30('0x30')],qs[_0xfe30('0x35')](_0x3dcd4e['query'][_0xfe30('0x35')]));_0x2f9691[_0xfe30('0x36')]=_0x2f9691['attributes']['length']?_0x2f9691[_0xfe30('0x36')]:_0x174dfa[_0xfe30('0x30')];if(_0x3dcd4e[_0xfe30('0x34')]['includeAll']){_0x2f9691['include']=[{'all':!![]}];}_0x2f9691=_[_0xfe30('0x3c')]({},_0x2f9691,_0x3dcd4e['options']);return db[_0xfe30('0x2c')][_0xfe30('0x46')](_0x2f9691)['then'](handleEntityNotFound(_0x508614,null))[_0xfe30('0x47')](respondWithResult(_0x508614,null))[_0xfe30('0x44')](handleError(_0x508614,null));};exports['create']=function(_0x17cf71,_0x444e39){return db[_0xfe30('0x2c')][_0xfe30('0x48')](_0x17cf71[_0xfe30('0x49')],{})[_0xfe30('0x47')](respondWithResult(_0x444e39,0xc9))[_0xfe30('0x44')](handleError(_0x444e39,null));};exports[_0xfe30('0x25')]=function(_0x28d2b1,_0x5d4b98){if(_0x28d2b1[_0xfe30('0x49')]['id']){delete _0x28d2b1[_0xfe30('0x49')]['id'];}return db['ZendeskField'][_0xfe30('0x46')]({'where':{'id':_0x28d2b1['params']['id']}})['then'](handleEntityNotFound(_0x5d4b98,null))[_0xfe30('0x47')](saveUpdates(_0x28d2b1['body'],null))['then'](respondWithResult(_0x5d4b98,null))[_0xfe30('0x44')](handleError(_0x5d4b98,null));};exports[_0xfe30('0x4a')]=function(_0x139d3e,_0x23bc30){return db['ZendeskField']['find']({'where':{'id':_0x139d3e[_0xfe30('0x45')]['id']}})[_0xfe30('0x47')](handleEntityNotFound(_0x23bc30,null))['then'](removeEntity(_0x23bc30,null))[_0xfe30('0x44')](handleError(_0x23bc30,null));};
\ No newline at end of file
+var _0xd461=['order','sort','pick','filter','merge','where','type','VIRTUAL','options','ZendeskField','includeAll','include','rows','catch','show','params','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit'];(function(_0x459094,_0x5e04d5){var _0x18bc8d=function(_0x31a401){while(--_0x31a401){_0x459094['push'](_0x459094['shift']());}};_0x18bc8d(++_0x5e04d5);}(_0xd461,0x13f));var _0x1d46=function(_0x1b1757,_0x56fcf5){_0x1b1757=_0x1b1757-0x0;var _0x7dd252=_0xd461[_0x1b1757];return _0x7dd252;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d46('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d46('0x1'));var rp=require(_0x1d46('0x2'));var moment=require(_0x1d46('0x3'));var BPromise=require(_0x1d46('0x4'));var Mustache=require(_0x1d46('0x5'));var util=require(_0x1d46('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1d46('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d46('0x8'));var _=require(_0x1d46('0x9'));var squel=require(_0x1d46('0xa'));var crypto=require(_0x1d46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1d46('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1d46('0xd'));var Papa=require(_0x1d46('0xe'));var Redis=require(_0x1d46('0xf'));var authService=require(_0x1d46('0x10'));var qs=require(_0x1d46('0x11'));var as=require(_0x1d46('0x12'));var hardwareService=require(_0x1d46('0x13'));var logger=require('../../config/logger')(_0x1d46('0x14'));var utils=require('../../config/utils');var config=require(_0x1d46('0x15'));var licenseUtil=require(_0x1d46('0x16'));var db=require(_0x1d46('0x17'))['db'];function respondWithStatusCode(_0xde0200,_0x486c89){_0x486c89=_0x486c89||0xcc;return function(_0x5afb26){if(_0x5afb26){return _0xde0200[_0x1d46('0x18')](_0x486c89);}return _0xde0200[_0x1d46('0x19')](_0x486c89)['end']();};}function respondWithResult(_0x37f6a4,_0x282f52){_0x282f52=_0x282f52||0xc8;return function(_0x27f3ba){if(_0x27f3ba){return _0x37f6a4[_0x1d46('0x19')](_0x282f52)[_0x1d46('0x1a')](_0x27f3ba);}};}function respondWithFilteredResult(_0x16459c,_0x368810){return function(_0x3c405a){if(_0x3c405a){var _0x10b856=typeof _0x368810['offset']==='undefined'&&typeof _0x368810[_0x1d46('0x1b')]===_0x1d46('0x1c');var _0x75d289=_0x3c405a['count'];var _0x455582=_0x10b856?0x0:_0x368810['offset'];var _0x25e788=_0x10b856?_0x3c405a[_0x1d46('0x1d')]:_0x368810[_0x1d46('0x1e')]+_0x368810[_0x1d46('0x1b')];var _0xac9de0;if(_0x25e788>=_0x75d289){_0x25e788=_0x75d289;_0xac9de0=0xc8;}else{_0xac9de0=0xce;}_0x16459c[_0x1d46('0x19')](_0xac9de0);return _0x16459c[_0x1d46('0x1f')](_0x1d46('0x20'),_0x455582+'-'+_0x25e788+'/'+_0x75d289)[_0x1d46('0x1a')](_0x3c405a);}return null;};}function patchUpdates(_0x493972){return function(_0x54cf60){try{jsonpatch['apply'](_0x54cf60,_0x493972,!![]);}catch(_0x3c3902){return BPromise[_0x1d46('0x21')](_0x3c3902);}return _0x54cf60[_0x1d46('0x22')]();};}function saveUpdates(_0x19562c,_0x1bca54){return function(_0x2ad35c){if(_0x2ad35c){return _0x2ad35c[_0x1d46('0x23')](_0x19562c)[_0x1d46('0x24')](function(_0x167687){return _0x167687;});}return null;};}function removeEntity(_0x460f80,_0x4ada6e){return function(_0xe136dc){if(_0xe136dc){return _0xe136dc[_0x1d46('0x25')]()[_0x1d46('0x24')](function(){_0x460f80['status'](0xcc)[_0x1d46('0x26')]();});}};}function handleEntityNotFound(_0x18f781,_0x6515fd){return function(_0x4aa2de){if(!_0x4aa2de){_0x18f781[_0x1d46('0x18')](0x194);}return _0x4aa2de;};}function handleError(_0x1907ea,_0x2b4761){_0x2b4761=_0x2b4761||0x1f4;return function(_0xa1cf5a){logger[_0x1d46('0x27')](_0xa1cf5a[_0x1d46('0x28')]);if(_0xa1cf5a[_0x1d46('0x29')]){delete _0xa1cf5a[_0x1d46('0x29')];}_0x1907ea['status'](_0x2b4761)[_0x1d46('0x2a')](_0xa1cf5a);};}exports['index']=function(_0x1c4b17,_0x3e483e){var _0x35de26={},_0x348696={},_0x2a2094={'count':0x0,'rows':[]};var _0x39710a=_[_0x1d46('0x2b')](db['ZendeskField'][_0x1d46('0x2c')],function(_0x9e6864){return{'name':_0x9e6864[_0x1d46('0x2d')],'type':_0x9e6864['type'][_0x1d46('0x2e')]};});_0x348696[_0x1d46('0x2f')]=_['map'](_0x39710a,_0x1d46('0x29'));_0x348696[_0x1d46('0x30')]=_[_0x1d46('0x31')](_0x1c4b17['query']);_0x348696[_0x1d46('0x32')]=_[_0x1d46('0x33')](_0x348696[_0x1d46('0x2f')],_0x348696['query']);_0x35de26['attributes']=_[_0x1d46('0x33')](_0x348696['model'],qs['fields'](_0x1c4b17[_0x1d46('0x30')][_0x1d46('0x34')]));_0x35de26[_0x1d46('0x35')]=_0x35de26[_0x1d46('0x35')][_0x1d46('0x36')]?_0x35de26[_0x1d46('0x35')]:_0x348696['model'];if(!_0x1c4b17[_0x1d46('0x30')]['hasOwnProperty'](_0x1d46('0x37'))){_0x35de26['limit']=qs[_0x1d46('0x1b')](_0x1c4b17[_0x1d46('0x30')]['limit']);_0x35de26[_0x1d46('0x1e')]=qs['offset'](_0x1c4b17[_0x1d46('0x30')][_0x1d46('0x1e')]);}_0x35de26[_0x1d46('0x38')]=qs['sort'](_0x1c4b17['query'][_0x1d46('0x39')]);_0x35de26['where']=qs[_0x1d46('0x32')](_[_0x1d46('0x3a')](_0x1c4b17[_0x1d46('0x30')],_0x348696[_0x1d46('0x32')]),_0x39710a);if(_0x1c4b17['query'][_0x1d46('0x3b')]){_0x35de26['where']=_[_0x1d46('0x3c')](_0x35de26[_0x1d46('0x3d')],{'$or':_[_0x1d46('0x2b')](_0x39710a,function(_0x1093f1){if(_0x1093f1[_0x1d46('0x3e')]!==_0x1d46('0x3f')){var _0x9910db={};_0x9910db[_0x1093f1[_0x1d46('0x29')]]={'$like':'%'+_0x1c4b17[_0x1d46('0x30')][_0x1d46('0x3b')]+'%'};return _0x9910db;}})});}_0x35de26=_[_0x1d46('0x3c')]({},_0x35de26,_0x1c4b17[_0x1d46('0x40')]);var _0x2fa96c={'where':_0x35de26[_0x1d46('0x3d')]};return db[_0x1d46('0x41')][_0x1d46('0x1d')](_0x2fa96c)[_0x1d46('0x24')](function(_0x3d43c4){_0x2a2094[_0x1d46('0x1d')]=_0x3d43c4;if(_0x1c4b17[_0x1d46('0x30')][_0x1d46('0x42')]){_0x35de26[_0x1d46('0x43')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x35de26);})[_0x1d46('0x24')](function(_0x5baccc){_0x2a2094[_0x1d46('0x44')]=_0x5baccc;return _0x2a2094;})[_0x1d46('0x24')](respondWithFilteredResult(_0x3e483e,_0x35de26))[_0x1d46('0x45')](handleError(_0x3e483e,null));};exports[_0x1d46('0x46')]=function(_0x387033,_0x1f2da0){var _0x2c1bf4={'raw':!![],'where':{'id':_0x387033[_0x1d46('0x47')]['id']}},_0x14679c={};_0x14679c['model']=_['keys'](db[_0x1d46('0x41')][_0x1d46('0x2c')]);_0x14679c[_0x1d46('0x30')]=_[_0x1d46('0x31')](_0x387033['query']);_0x14679c[_0x1d46('0x32')]=_[_0x1d46('0x33')](_0x14679c[_0x1d46('0x2f')],_0x14679c[_0x1d46('0x30')]);_0x2c1bf4[_0x1d46('0x35')]=_['intersection'](_0x14679c[_0x1d46('0x2f')],qs[_0x1d46('0x34')](_0x387033[_0x1d46('0x30')][_0x1d46('0x34')]));_0x2c1bf4[_0x1d46('0x35')]=_0x2c1bf4['attributes']['length']?_0x2c1bf4[_0x1d46('0x35')]:_0x14679c[_0x1d46('0x2f')];if(_0x387033[_0x1d46('0x30')][_0x1d46('0x42')]){_0x2c1bf4[_0x1d46('0x43')]=[{'all':!![]}];}_0x2c1bf4=_[_0x1d46('0x3c')]({},_0x2c1bf4,_0x387033['options']);return db[_0x1d46('0x41')][_0x1d46('0x48')](_0x2c1bf4)[_0x1d46('0x24')](handleEntityNotFound(_0x1f2da0,null))[_0x1d46('0x24')](respondWithResult(_0x1f2da0,null))['catch'](handleError(_0x1f2da0,null));};exports[_0x1d46('0x49')]=function(_0x375f55,_0x47f2a5){return db[_0x1d46('0x41')][_0x1d46('0x49')](_0x375f55[_0x1d46('0x4a')],{})[_0x1d46('0x24')](respondWithResult(_0x47f2a5,0xc9))['catch'](handleError(_0x47f2a5,null));};exports[_0x1d46('0x23')]=function(_0x32379c,_0x254b67){if(_0x32379c[_0x1d46('0x4a')]['id']){delete _0x32379c[_0x1d46('0x4a')]['id'];}return db[_0x1d46('0x41')][_0x1d46('0x48')]({'where':{'id':_0x32379c[_0x1d46('0x47')]['id']}})[_0x1d46('0x24')](handleEntityNotFound(_0x254b67,null))[_0x1d46('0x24')](saveUpdates(_0x32379c[_0x1d46('0x4a')],null))[_0x1d46('0x24')](respondWithResult(_0x254b67,null))[_0x1d46('0x45')](handleError(_0x254b67,null));};exports['destroy']=function(_0x154516,_0x14cef8){return db[_0x1d46('0x41')][_0x1d46('0x48')]({'where':{'id':_0x154516['params']['id']}})[_0x1d46('0x24')](handleEntityNotFound(_0x14cef8,null))[_0x1d46('0x24')](removeEntity(_0x14cef8,null))['catch'](handleError(_0x14cef8,null));};
\ No newline at end of file