Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / intDeskField / intDeskField.controller.js
index 1a4a1e9..5c7bb12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6605=['show','params','intersection','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','count','offset','status','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','key','VIRTUAL','field','options','DeskField','then','includeAll','include','findAll','rows','catch'];(function(_0x1ca7c4,_0x1436c8){var _0x5399c7=function(_0x3fb321){while(--_0x3fb321){_0x1ca7c4['push'](_0x1ca7c4['shift']());}};_0x5399c7(++_0x1436c8);}(_0x6605,0xd3));var _0x5660=function(_0xb1e15d,_0x3abd77){_0xb1e15d=_0xb1e15d-0x0;var _0x4c7a4a=_0x6605[_0xb1e15d];return _0x4c7a4a;};'use strict';var pdf=require(_0x5660('0x0'));var emlformat=require(_0x5660('0x1'));var rimraf=require(_0x5660('0x2'));var zipdir=require(_0x5660('0x3'));var jsonpatch=require(_0x5660('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5660('0x5'));var util=require('util');var path=require(_0x5660('0x6'));var sox=require(_0x5660('0x7'));var csv=require(_0x5660('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5660('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5660('0xa'));var deskjs=require(_0x5660('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5660('0xc'));var Papa=require(_0x5660('0xd'));var Redis=require(_0x5660('0xe'));var authService=require(_0x5660('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x5660('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x5660('0x11'));var config=require('../../config/environment');var db=require(_0x5660('0x12'))['db'];function respondWithStatusCode(_0x49203e,_0x3903a6){_0x3903a6=_0x3903a6||0xcc;return function(_0x42f626){if(_0x42f626){return _0x49203e[_0x5660('0x13')](_0x3903a6);}return _0x49203e['status'](_0x3903a6)[_0x5660('0x14')]();};}function respondWithResult(_0x4b94e1,_0x231ef2){_0x231ef2=_0x231ef2||0xc8;return function(_0x446ce2){if(_0x446ce2){return _0x4b94e1['status'](_0x231ef2)['json'](_0x446ce2);}};}function respondWithFilteredResult(_0x1b0028,_0x4eb74b){return function(_0x35b08e){if(_0x35b08e){var _0x75c281=_0x35b08e[_0x5660('0x15')],_0x480c92=_0x4eb74b[_0x5660('0x16')],_0x1900eb=_0x4eb74b[_0x5660('0x16')]+_0x4eb74b['limit'],_0x3b22eb;if(_0x1900eb>=_0x75c281){_0x1900eb=_0x75c281;_0x3b22eb=0xc8;}else{_0x3b22eb=0xce;}_0x1b0028[_0x5660('0x17')](_0x3b22eb);return _0x1b0028[_0x5660('0x18')](_0x5660('0x19'),_0x480c92+'-'+_0x1900eb+'/'+_0x75c281)['json'](_0x35b08e);}return null;};}function patchUpdates(_0xf6f3de){return function(_0x1fbd47){try{jsonpatch['apply'](_0x1fbd47,_0xf6f3de,!![]);}catch(_0x59decc){return BPromise[_0x5660('0x1a')](_0x59decc);}return _0x1fbd47[_0x5660('0x1b')]();};}function saveUpdates(_0xe7e9b7,_0x317085){return function(_0x6636ee){if(_0x6636ee){return _0x6636ee[_0x5660('0x1c')](_0xe7e9b7)['then'](function(_0x24e2d6){return _0x24e2d6;});}return null;};}function removeEntity(_0x1d1fbb,_0x3fb4f8){return function(_0x43621b){if(_0x43621b){return _0x43621b[_0x5660('0x1d')]()['then'](function(){_0x1d1fbb[_0x5660('0x17')](0xcc)[_0x5660('0x14')]();});}};}function handleEntityNotFound(_0x1055db,_0x4888f4){return function(_0x4478be){if(!_0x4478be){_0x1055db[_0x5660('0x13')](0x194);}return _0x4478be;};}function handleError(_0x539f28,_0x45d6d1){_0x45d6d1=_0x45d6d1||0x1f4;return function(_0x28c524){logger[_0x5660('0x1e')](_0x28c524[_0x5660('0x1f')]);if(_0x28c524['name']){delete _0x28c524[_0x5660('0x20')];}_0x539f28[_0x5660('0x17')](_0x45d6d1)[_0x5660('0x21')](_0x28c524);};}exports[_0x5660('0x22')]=function(_0x586948,_0x541af0){var _0x112c82={},_0x47f920={},_0x58ebf4={'count':0x0,'rows':[]};var _0x288e4a=db['DeskField'][_0x5660('0x23')];_0x47f920[_0x5660('0x24')]=_['keys'](_0x288e4a);_0x47f920[_0x5660('0x25')]=_[_0x5660('0x26')](_0x586948[_0x5660('0x25')]);_0x47f920[_0x5660('0x27')]=_['intersection'](_0x47f920[_0x5660('0x24')],_0x47f920['query']);_0x112c82[_0x5660('0x28')]=_['intersection'](_0x47f920[_0x5660('0x24')],qs['fields'](_0x586948['query'][_0x5660('0x29')]));_0x112c82[_0x5660('0x28')]=_0x112c82['attributes']['length']?_0x112c82[_0x5660('0x28')]:_0x47f920[_0x5660('0x24')];if(!_0x586948[_0x5660('0x25')][_0x5660('0x2a')](_0x5660('0x2b'))){_0x112c82[_0x5660('0x2c')]=qs[_0x5660('0x2c')](_0x586948[_0x5660('0x25')][_0x5660('0x2c')]);_0x112c82['offset']=qs[_0x5660('0x16')](_0x586948[_0x5660('0x25')][_0x5660('0x16')]);}_0x112c82['order']=qs[_0x5660('0x2d')](_0x586948['query']['sort']);_0x112c82[_0x5660('0x2e')]=qs['filters'](_['pick'](_0x586948[_0x5660('0x25')],_0x47f920[_0x5660('0x27')]));if(_0x586948[_0x5660('0x25')][_0x5660('0x2f')]){_0x112c82['where']=_[_0x5660('0x30')](_0x112c82[_0x5660('0x2e')],{'$or':_['map'](_0x288e4a,function(_0x4975bb){if(_0x4975bb[_0x5660('0x31')][_0x5660('0x32')]!==_0x5660('0x33')){var _0x34a6e1={};_0x34a6e1[_0x4975bb[_0x5660('0x34')]]={'$like':'%'+_0x586948[_0x5660('0x25')]['filter']+'%'};return _0x34a6e1;}})});}_0x112c82=_[_0x5660('0x30')]({},_0x112c82,_0x586948[_0x5660('0x35')]);var _0x4934ad={'where':_0x112c82[_0x5660('0x2e')]};return db[_0x5660('0x36')][_0x5660('0x15')](_0x4934ad)[_0x5660('0x37')](function(_0x8e1b76){_0x58ebf4['count']=_0x8e1b76;if(_0x586948[_0x5660('0x25')][_0x5660('0x38')]){_0x112c82[_0x5660('0x39')]=[{'all':!![]}];}return db['DeskField'][_0x5660('0x3a')](_0x112c82);})[_0x5660('0x37')](function(_0x32c8d2){_0x58ebf4[_0x5660('0x3b')]=_0x32c8d2;return _0x58ebf4;})['then'](respondWithFilteredResult(_0x541af0,_0x112c82))[_0x5660('0x3c')](handleError(_0x541af0,null));};exports[_0x5660('0x3d')]=function(_0x263196,_0x2f23de){var _0x2e9503={'raw':!![],'where':{'id':_0x263196[_0x5660('0x3e')]['id']}},_0x54e684={};_0x54e684[_0x5660('0x24')]=_[_0x5660('0x26')](db[_0x5660('0x36')][_0x5660('0x23')]);_0x54e684[_0x5660('0x25')]=_[_0x5660('0x26')](_0x263196[_0x5660('0x25')]);_0x54e684[_0x5660('0x27')]=_['intersection'](_0x54e684[_0x5660('0x24')],_0x54e684[_0x5660('0x25')]);_0x2e9503[_0x5660('0x28')]=_[_0x5660('0x3f')](_0x54e684[_0x5660('0x24')],qs[_0x5660('0x29')](_0x263196[_0x5660('0x25')][_0x5660('0x29')]));_0x2e9503['attributes']=_0x2e9503[_0x5660('0x28')][_0x5660('0x40')]?_0x2e9503[_0x5660('0x28')]:_0x54e684['model'];if(_0x263196[_0x5660('0x25')][_0x5660('0x38')]){_0x2e9503[_0x5660('0x39')]=[{'all':!![]}];}_0x2e9503=_[_0x5660('0x30')]({},_0x2e9503,_0x263196[_0x5660('0x35')]);return db[_0x5660('0x36')][_0x5660('0x41')](_0x2e9503)['then'](handleEntityNotFound(_0x2f23de,null))[_0x5660('0x37')](respondWithResult(_0x2f23de,null))['catch'](handleError(_0x2f23de,null));};exports[_0x5660('0x42')]=function(_0x1f5f12,_0x44ca79){return db[_0x5660('0x36')][_0x5660('0x42')](_0x1f5f12[_0x5660('0x43')],{})[_0x5660('0x37')](respondWithResult(_0x44ca79,0xc9))[_0x5660('0x3c')](handleError(_0x44ca79,null));};exports[_0x5660('0x1c')]=function(_0x2db673,_0x25447f){if(_0x2db673[_0x5660('0x43')]['id']){delete _0x2db673[_0x5660('0x43')]['id'];}return db[_0x5660('0x36')]['find']({'where':{'id':_0x2db673['params']['id']}})['then'](handleEntityNotFound(_0x25447f,null))['then'](saveUpdates(_0x2db673[_0x5660('0x43')],null))[_0x5660('0x37')](respondWithResult(_0x25447f,null))[_0x5660('0x3c')](handleError(_0x25447f,null));};exports[_0x5660('0x1d')]=function(_0x154075,_0x3f79f3){return db[_0x5660('0x36')][_0x5660('0x41')]({'where':{'id':_0x154075[_0x5660('0x3e')]['id']}})[_0x5660('0x37')](handleEntityNotFound(_0x3f79f3,null))[_0x5660('0x37')](removeEntity(_0x3f79f3,null))[_0x5660('0x3c')](handleError(_0x3f79f3,null));};
\ No newline at end of file
+var _0x998f=['moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','then','destroy','sendStatus','stack','name','send','DeskField','keys','filters','intersection','model','query','fields','attributes','length','nolimit','order','sort','where','filter','map','type','key','field','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3d27ac,_0x208227){var _0x17e1ae=function(_0x3aa519){while(--_0x3aa519){_0x3d27ac['push'](_0x3d27ac['shift']());}};_0x17e1ae(++_0x208227);}(_0x998f,0x150));var _0xf998=function(_0x56025c,_0x296025){_0x56025c=_0x56025c-0x0;var _0x11755c=_0x998f[_0x56025c];return _0x11755c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf998('0x0'));var rimraf=require(_0xf998('0x1'));var zipdir=require(_0xf998('0x2'));var jsonpatch=require(_0xf998('0x3'));var rp=require('request-promise');var moment=require(_0xf998('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf998('0x5'));var path=require(_0xf998('0x6'));var sox=require(_0xf998('0x7'));var csv=require(_0xf998('0x8'));var ejs=require(_0xf998('0x9'));var fs=require('fs');var _=require(_0xf998('0xa'));var squel=require(_0xf998('0xb'));var crypto=require(_0xf998('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf998('0xd'));var toCsv=require(_0xf998('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf998('0xe'));var authService=require(_0xf998('0xf'));var qs=require(_0xf998('0x10'));var hardwareService=require(_0xf998('0x11'));var logger=require('../../config/logger')(_0xf998('0x12'));var utils=require(_0xf998('0x13'));var config=require(_0xf998('0x14'));var db=require(_0xf998('0x15'))['db'];function respondWithStatusCode(_0x2d827c,_0x52fe82){_0x52fe82=_0x52fe82||0xcc;return function(_0x493c1c){if(_0x493c1c){return _0x2d827c['sendStatus'](_0x52fe82);}return _0x2d827c[_0xf998('0x16')](_0x52fe82)[_0xf998('0x17')]();};}function respondWithResult(_0x884907,_0x264396){_0x264396=_0x264396||0xc8;return function(_0x4f509d){if(_0x4f509d){return _0x884907[_0xf998('0x16')](_0x264396)[_0xf998('0x18')](_0x4f509d);}};}function respondWithFilteredResult(_0x395a78,_0x2223b2){return function(_0x55d238){if(_0x55d238){var _0x22003c=_0x55d238[_0xf998('0x19')],_0x12adc2=_0x2223b2[_0xf998('0x1a')],_0x54a608=_0x2223b2[_0xf998('0x1a')]+_0x2223b2[_0xf998('0x1b')],_0x533dd4;if(_0x54a608>=_0x22003c){_0x54a608=_0x22003c;_0x533dd4=0xc8;}else{_0x533dd4=0xce;}_0x395a78[_0xf998('0x16')](_0x533dd4);return _0x395a78['set']('Content-Range',_0x12adc2+'-'+_0x54a608+'/'+_0x22003c)[_0xf998('0x18')](_0x55d238);}return null;};}function patchUpdates(_0x1b3680){return function(_0xfec3f){try{jsonpatch[_0xf998('0x1c')](_0xfec3f,_0x1b3680,!![]);}catch(_0x286f08){return BPromise[_0xf998('0x1d')](_0x286f08);}return _0xfec3f['save']();};}function saveUpdates(_0x37a459,_0x114380){return function(_0xcbe3f6){if(_0xcbe3f6){return _0xcbe3f6['update'](_0x37a459)[_0xf998('0x1e')](function(_0x1cbd07){return _0x1cbd07;});}return null;};}function removeEntity(_0x143957,_0x1630e8){return function(_0xae269){if(_0xae269){return _0xae269[_0xf998('0x1f')]()[_0xf998('0x1e')](function(){_0x143957['status'](0xcc)[_0xf998('0x17')]();});}};}function handleEntityNotFound(_0x42c35f,_0x2d809a){return function(_0x1f11e6){if(!_0x1f11e6){_0x42c35f[_0xf998('0x20')](0x194);}return _0x1f11e6;};}function handleError(_0xb7e1cc,_0x40783e){_0x40783e=_0x40783e||0x1f4;return function(_0x476b3b){logger['error'](_0x476b3b[_0xf998('0x21')]);if(_0x476b3b[_0xf998('0x22')]){delete _0x476b3b[_0xf998('0x22')];}_0xb7e1cc['status'](_0x40783e)[_0xf998('0x23')](_0x476b3b);};}exports['index']=function(_0x48081f,_0x439de0){var _0x36a1d6={},_0x402b4e={},_0xaa4b32={'count':0x0,'rows':[]};var _0x266903=db[_0xf998('0x24')]['rawAttributes'];_0x402b4e['model']=_['keys'](_0x266903);_0x402b4e['query']=_[_0xf998('0x25')](_0x48081f['query']);_0x402b4e[_0xf998('0x26')]=_[_0xf998('0x27')](_0x402b4e[_0xf998('0x28')],_0x402b4e[_0xf998('0x29')]);_0x36a1d6['attributes']=_[_0xf998('0x27')](_0x402b4e[_0xf998('0x28')],qs['fields'](_0x48081f[_0xf998('0x29')][_0xf998('0x2a')]));_0x36a1d6['attributes']=_0x36a1d6[_0xf998('0x2b')][_0xf998('0x2c')]?_0x36a1d6[_0xf998('0x2b')]:_0x402b4e['model'];if(!_0x48081f[_0xf998('0x29')]['hasOwnProperty'](_0xf998('0x2d'))){_0x36a1d6[_0xf998('0x1b')]=qs['limit'](_0x48081f['query']['limit']);_0x36a1d6['offset']=qs[_0xf998('0x1a')](_0x48081f['query']['offset']);}_0x36a1d6[_0xf998('0x2e')]=qs[_0xf998('0x2f')](_0x48081f['query']['sort']);_0x36a1d6[_0xf998('0x30')]=qs[_0xf998('0x26')](_['pick'](_0x48081f['query'],_0x402b4e[_0xf998('0x26')]));if(_0x48081f[_0xf998('0x29')][_0xf998('0x31')]){_0x36a1d6[_0xf998('0x30')]=_['merge'](_0x36a1d6[_0xf998('0x30')],{'$or':_[_0xf998('0x32')](_0x266903,function(_0x45af0a){if(_0x45af0a[_0xf998('0x33')][_0xf998('0x34')]!=='VIRTUAL'){var _0x51deba={};_0x51deba[_0x45af0a[_0xf998('0x35')]]={'$like':'%'+_0x48081f[_0xf998('0x29')][_0xf998('0x31')]+'%'};return _0x51deba;}})});}_0x36a1d6=_[_0xf998('0x36')]({},_0x36a1d6,_0x48081f[_0xf998('0x37')]);var _0x545c12={'where':_0x36a1d6[_0xf998('0x30')]};return db['DeskField'][_0xf998('0x19')](_0x545c12)[_0xf998('0x1e')](function(_0x15b96c){_0xaa4b32[_0xf998('0x19')]=_0x15b96c;if(_0x48081f[_0xf998('0x29')][_0xf998('0x38')]){_0x36a1d6[_0xf998('0x39')]=[{'all':!![]}];}return db[_0xf998('0x24')][_0xf998('0x3a')](_0x36a1d6);})[_0xf998('0x1e')](function(_0x58c373){_0xaa4b32[_0xf998('0x3b')]=_0x58c373;return _0xaa4b32;})[_0xf998('0x1e')](respondWithFilteredResult(_0x439de0,_0x36a1d6))[_0xf998('0x3c')](handleError(_0x439de0,null));};exports[_0xf998('0x3d')]=function(_0x452220,_0xf7162f){var _0x20adc6={'raw':!![],'where':{'id':_0x452220[_0xf998('0x3e')]['id']}},_0x38f11a={};_0x38f11a['model']=_['keys'](db[_0xf998('0x24')][_0xf998('0x3f')]);_0x38f11a[_0xf998('0x29')]=_[_0xf998('0x25')](_0x452220[_0xf998('0x29')]);_0x38f11a[_0xf998('0x26')]=_[_0xf998('0x27')](_0x38f11a[_0xf998('0x28')],_0x38f11a[_0xf998('0x29')]);_0x20adc6[_0xf998('0x2b')]=_['intersection'](_0x38f11a[_0xf998('0x28')],qs[_0xf998('0x2a')](_0x452220[_0xf998('0x29')][_0xf998('0x2a')]));_0x20adc6['attributes']=_0x20adc6['attributes'][_0xf998('0x2c')]?_0x20adc6[_0xf998('0x2b')]:_0x38f11a[_0xf998('0x28')];if(_0x452220[_0xf998('0x29')][_0xf998('0x38')]){_0x20adc6[_0xf998('0x39')]=[{'all':!![]}];}_0x20adc6=_[_0xf998('0x36')]({},_0x20adc6,_0x452220[_0xf998('0x37')]);return db['DeskField'][_0xf998('0x40')](_0x20adc6)['then'](handleEntityNotFound(_0xf7162f,null))[_0xf998('0x1e')](respondWithResult(_0xf7162f,null))[_0xf998('0x3c')](handleError(_0xf7162f,null));};exports[_0xf998('0x41')]=function(_0x1a9d70,_0x2812db){return db[_0xf998('0x24')][_0xf998('0x41')](_0x1a9d70[_0xf998('0x42')],{})[_0xf998('0x1e')](respondWithResult(_0x2812db,0xc9))[_0xf998('0x3c')](handleError(_0x2812db,null));};exports[_0xf998('0x43')]=function(_0x92a87e,_0x997def){if(_0x92a87e['body']['id']){delete _0x92a87e[_0xf998('0x42')]['id'];}return db[_0xf998('0x24')][_0xf998('0x40')]({'where':{'id':_0x92a87e[_0xf998('0x3e')]['id']}})['then'](handleEntityNotFound(_0x997def,null))[_0xf998('0x1e')](saveUpdates(_0x92a87e[_0xf998('0x42')],null))[_0xf998('0x1e')](respondWithResult(_0x997def,null))[_0xf998('0x3c')](handleError(_0x997def,null));};exports['destroy']=function(_0x17f06a,_0x42ff0d){return db[_0xf998('0x24')][_0xf998('0x40')]({'where':{'id':_0x17f06a[_0xf998('0x3e')]['id']}})['then'](handleEntityNotFound(_0x42ff0d,null))[_0xf998('0x1e')](removeEntity(_0x42ff0d,null))[_0xf998('0x3c')](handleError(_0x42ff0d,null));};
\ No newline at end of file