Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / intZohoField / intZohoField.controller.js
index f71e041..c2711ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f99=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','reject','then','destroy','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x5f99,0x19b));var _0x95f9=function(_0x30bc90,_0x2499a2){_0x30bc90=_0x30bc90-0x0;var _0x2db767=_0x5f99[_0x30bc90];return _0x2db767;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x95f9('0x0'));var rimraf=require(_0x95f9('0x1'));var zipdir=require(_0x95f9('0x2'));var jsonpatch=require(_0x95f9('0x3'));var rp=require(_0x95f9('0x4'));var moment=require(_0x95f9('0x5'));var BPromise=require(_0x95f9('0x6'));var Mustache=require(_0x95f9('0x7'));var util=require('util');var path=require(_0x95f9('0x8'));var sox=require(_0x95f9('0x9'));var csv=require('to-csv');var ejs=require(_0x95f9('0xa'));var fs=require('fs');var _=require(_0x95f9('0xb'));var squel=require('squel');var crypto=require(_0x95f9('0xc'));var jsforce=require(_0x95f9('0xd'));var deskjs=require(_0x95f9('0xe'));var toCsv=require(_0x95f9('0xf'));var querystring=require(_0x95f9('0x10'));var Papa=require(_0x95f9('0x11'));var Redis=require(_0x95f9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95f9('0x13'));var logger=require(_0x95f9('0x14'))(_0x95f9('0x15'));var utils=require(_0x95f9('0x16'));var config=require(_0x95f9('0x17'));var licenseUtil=require(_0x95f9('0x18'));var db=require(_0x95f9('0x19'))['db'];function respondWithStatusCode(_0x2134cf,_0x378853){_0x378853=_0x378853||0xcc;return function(_0x33e018){if(_0x33e018){return _0x2134cf[_0x95f9('0x1a')](_0x378853);}return _0x2134cf['status'](_0x378853)['end']();};}function respondWithResult(_0x15b149,_0x5b9555){_0x5b9555=_0x5b9555||0xc8;return function(_0x2cc28f){if(_0x2cc28f){return _0x15b149[_0x95f9('0x1b')](_0x5b9555)['json'](_0x2cc28f);}};}function respondWithFilteredResult(_0x309e06,_0x2e447e){return function(_0x36c598){if(_0x36c598){var _0x2a4af0=_0x36c598[_0x95f9('0x1c')],_0x45d88f=_0x2e447e['offset'],_0x1d9f25=_0x2e447e[_0x95f9('0x1d')]+_0x2e447e[_0x95f9('0x1e')],_0x18af10;if(_0x1d9f25>=_0x2a4af0){_0x1d9f25=_0x2a4af0;_0x18af10=0xc8;}else{_0x18af10=0xce;}_0x309e06[_0x95f9('0x1b')](_0x18af10);return _0x309e06['set'](_0x95f9('0x1f'),_0x45d88f+'-'+_0x1d9f25+'/'+_0x2a4af0)['json'](_0x36c598);}return null;};}function patchUpdates(_0x5b3153){return function(_0x32d80a){try{jsonpatch['apply'](_0x32d80a,_0x5b3153,!![]);}catch(_0x2eb416){return BPromise[_0x95f9('0x20')](_0x2eb416);}return _0x32d80a['save']();};}function saveUpdates(_0x31870d,_0x523411){return function(_0x377dad){if(_0x377dad){return _0x377dad['update'](_0x31870d)[_0x95f9('0x21')](function(_0x216bf5){return _0x216bf5;});}return null;};}function removeEntity(_0xb2694c,_0x146686){return function(_0x5a5a28){if(_0x5a5a28){return _0x5a5a28[_0x95f9('0x22')]()[_0x95f9('0x21')](function(){_0xb2694c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb2d491,_0x274715){return function(_0x88205e){if(!_0x88205e){_0xb2d491[_0x95f9('0x1a')](0x194);}return _0x88205e;};}function handleError(_0x50952b,_0x4cc5bf){_0x4cc5bf=_0x4cc5bf||0x1f4;return function(_0x558c6f){logger[_0x95f9('0x23')](_0x558c6f['stack']);if(_0x558c6f[_0x95f9('0x24')]){delete _0x558c6f['name'];}_0x50952b['status'](_0x4cc5bf)[_0x95f9('0x25')](_0x558c6f);};}exports[_0x95f9('0x26')]=function(_0x476066,_0x562e81){var _0x27416d={},_0x1ae3da={},_0x507b39={'count':0x0,'rows':[]};var _0x3706fd=_[_0x95f9('0x27')](db[_0x95f9('0x28')][_0x95f9('0x29')],function(_0x415ed4){return{'name':_0x415ed4[_0x95f9('0x2a')],'type':_0x415ed4[_0x95f9('0x2b')][_0x95f9('0x2c')]};});_0x1ae3da['model']=_[_0x95f9('0x27')](_0x3706fd,_0x95f9('0x24'));_0x1ae3da['query']=_[_0x95f9('0x2d')](_0x476066[_0x95f9('0x2e')]);_0x1ae3da[_0x95f9('0x2f')]=_[_0x95f9('0x30')](_0x1ae3da['model'],_0x1ae3da[_0x95f9('0x2e')]);_0x27416d[_0x95f9('0x31')]=_[_0x95f9('0x30')](_0x1ae3da[_0x95f9('0x32')],qs[_0x95f9('0x33')](_0x476066[_0x95f9('0x2e')][_0x95f9('0x33')]));_0x27416d[_0x95f9('0x31')]=_0x27416d[_0x95f9('0x31')][_0x95f9('0x34')]?_0x27416d[_0x95f9('0x31')]:_0x1ae3da[_0x95f9('0x32')];if(!_0x476066[_0x95f9('0x2e')][_0x95f9('0x35')](_0x95f9('0x36'))){_0x27416d['limit']=qs['limit'](_0x476066[_0x95f9('0x2e')][_0x95f9('0x1e')]);_0x27416d[_0x95f9('0x1d')]=qs[_0x95f9('0x1d')](_0x476066[_0x95f9('0x2e')][_0x95f9('0x1d')]);}_0x27416d[_0x95f9('0x37')]=qs[_0x95f9('0x38')](_0x476066['query'][_0x95f9('0x38')]);_0x27416d[_0x95f9('0x39')]=qs[_0x95f9('0x2f')](_[_0x95f9('0x3a')](_0x476066[_0x95f9('0x2e')],_0x1ae3da['filters']),_0x3706fd);if(_0x476066[_0x95f9('0x2e')][_0x95f9('0x3b')]){_0x27416d[_0x95f9('0x39')]=_['merge'](_0x27416d['where'],{'$or':_[_0x95f9('0x27')](_0x3706fd,function(_0x2dc949){if(_0x2dc949[_0x95f9('0x2b')]!==_0x95f9('0x3c')){var _0x97d4b2={};_0x97d4b2[_0x2dc949['name']]={'$like':'%'+_0x476066[_0x95f9('0x2e')][_0x95f9('0x3b')]+'%'};return _0x97d4b2;}})});}_0x27416d=_[_0x95f9('0x3d')]({},_0x27416d,_0x476066[_0x95f9('0x3e')]);var _0x397dc9={'where':_0x27416d[_0x95f9('0x39')]};return db[_0x95f9('0x28')][_0x95f9('0x1c')](_0x397dc9)['then'](function(_0x6baf83){_0x507b39[_0x95f9('0x1c')]=_0x6baf83;if(_0x476066[_0x95f9('0x2e')][_0x95f9('0x3f')]){_0x27416d['include']=[{'all':!![]}];}return db[_0x95f9('0x28')][_0x95f9('0x40')](_0x27416d);})[_0x95f9('0x21')](function(_0x2350d9){_0x507b39[_0x95f9('0x41')]=_0x2350d9;return _0x507b39;})[_0x95f9('0x21')](respondWithFilteredResult(_0x562e81,_0x27416d))[_0x95f9('0x42')](handleError(_0x562e81,null));};exports['show']=function(_0x2562b0,_0x2a4460){var _0x5c3b62={'raw':!![],'where':{'id':_0x2562b0[_0x95f9('0x43')]['id']}},_0x2d6011={};_0x2d6011[_0x95f9('0x32')]=_['keys'](db[_0x95f9('0x28')][_0x95f9('0x29')]);_0x2d6011[_0x95f9('0x2e')]=_[_0x95f9('0x2d')](_0x2562b0[_0x95f9('0x2e')]);_0x2d6011['filters']=_[_0x95f9('0x30')](_0x2d6011[_0x95f9('0x32')],_0x2d6011[_0x95f9('0x2e')]);_0x5c3b62['attributes']=_[_0x95f9('0x30')](_0x2d6011[_0x95f9('0x32')],qs[_0x95f9('0x33')](_0x2562b0[_0x95f9('0x2e')][_0x95f9('0x33')]));_0x5c3b62[_0x95f9('0x31')]=_0x5c3b62[_0x95f9('0x31')][_0x95f9('0x34')]?_0x5c3b62['attributes']:_0x2d6011[_0x95f9('0x32')];if(_0x2562b0['query'][_0x95f9('0x3f')]){_0x5c3b62['include']=[{'all':!![]}];}_0x5c3b62=_[_0x95f9('0x3d')]({},_0x5c3b62,_0x2562b0[_0x95f9('0x3e')]);return db[_0x95f9('0x28')][_0x95f9('0x44')](_0x5c3b62)[_0x95f9('0x21')](handleEntityNotFound(_0x2a4460,null))[_0x95f9('0x21')](respondWithResult(_0x2a4460,null))[_0x95f9('0x42')](handleError(_0x2a4460,null));};exports[_0x95f9('0x45')]=function(_0x5134f6,_0x17dc6a){return db[_0x95f9('0x28')][_0x95f9('0x45')](_0x5134f6[_0x95f9('0x46')],{})['then'](respondWithResult(_0x17dc6a,0xc9))[_0x95f9('0x42')](handleError(_0x17dc6a,null));};exports[_0x95f9('0x47')]=function(_0x5efe11,_0x791f2){if(_0x5efe11[_0x95f9('0x46')]['id']){delete _0x5efe11[_0x95f9('0x46')]['id'];}return db[_0x95f9('0x28')][_0x95f9('0x44')]({'where':{'id':_0x5efe11[_0x95f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x791f2,null))[_0x95f9('0x21')](saveUpdates(_0x5efe11[_0x95f9('0x46')],null))['then'](respondWithResult(_0x791f2,null))['catch'](handleError(_0x791f2,null));};exports[_0x95f9('0x22')]=function(_0x3d50a8,_0x10fd77){return db[_0x95f9('0x28')][_0x95f9('0x44')]({'where':{'id':_0x3d50a8[_0x95f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x10fd77,null))[_0x95f9('0x21')](removeEntity(_0x10fd77,null))[_0x95f9('0x42')](handleError(_0x10fd77,null));};
\ No newline at end of file
+var _0x06a9=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','ZohoField','rawAttributes','fieldName','key','model','map'];(function(_0x646db5,_0x5a483b){var _0x27288d=function(_0x20e61c){while(--_0x20e61c){_0x646db5['push'](_0x646db5['shift']());}};_0x27288d(++_0x5a483b);}(_0x06a9,0xb7));var _0x906a=function(_0xb22b4b,_0x564a03){_0xb22b4b=_0xb22b4b-0x0;var _0x145a36=_0x06a9[_0xb22b4b];return _0x145a36;};'use strict';var emlformat=require(_0x906a('0x0'));var rimraf=require(_0x906a('0x1'));var zipdir=require(_0x906a('0x2'));var jsonpatch=require(_0x906a('0x3'));var rp=require('request-promise');var moment=require(_0x906a('0x4'));var BPromise=require(_0x906a('0x5'));var Mustache=require(_0x906a('0x6'));var util=require(_0x906a('0x7'));var path=require(_0x906a('0x8'));var sox=require(_0x906a('0x9'));var csv=require(_0x906a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x906a('0xb'));var _=require(_0x906a('0xc'));var squel=require(_0x906a('0xd'));var crypto=require('crypto');var jsforce=require(_0x906a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x906a('0xa'));var querystring=require(_0x906a('0xf'));var Papa=require(_0x906a('0x10'));var Redis=require(_0x906a('0x11'));var authService=require(_0x906a('0x12'));var qs=require(_0x906a('0x13'));var as=require(_0x906a('0x14'));var hardwareService=require(_0x906a('0x15'));var logger=require(_0x906a('0x16'))(_0x906a('0x17'));var utils=require('../../config/utils');var config=require(_0x906a('0x18'));var licenseUtil=require(_0x906a('0x19'));var db=require(_0x906a('0x1a'))['db'];function respondWithStatusCode(_0x5c36f6,_0x57a9fb){_0x57a9fb=_0x57a9fb||0xcc;return function(_0x37c562){if(_0x37c562){return _0x5c36f6[_0x906a('0x1b')](_0x57a9fb);}return _0x5c36f6[_0x906a('0x1c')](_0x57a9fb)[_0x906a('0x1d')]();};}function respondWithResult(_0x50d751,_0x35eac9){_0x35eac9=_0x35eac9||0xc8;return function(_0x5b8fcc){if(_0x5b8fcc){return _0x50d751[_0x906a('0x1c')](_0x35eac9)[_0x906a('0x1e')](_0x5b8fcc);}};}function respondWithFilteredResult(_0xa41004,_0x4565dd){return function(_0x252f9f){if(_0x252f9f){var _0x217971=typeof _0x4565dd[_0x906a('0x1f')]===_0x906a('0x20')&&typeof _0x4565dd[_0x906a('0x21')]==='undefined';var _0x971b1a=_0x252f9f['count'];var _0x2a6e96=_0x217971?0x0:_0x4565dd[_0x906a('0x1f')];var _0x4ad4bc=_0x217971?_0x252f9f[_0x906a('0x22')]:_0x4565dd[_0x906a('0x1f')]+_0x4565dd[_0x906a('0x21')];var _0x49db8d;if(_0x4ad4bc>=_0x971b1a){_0x4ad4bc=_0x971b1a;_0x49db8d=0xc8;}else{_0x49db8d=0xce;}_0xa41004[_0x906a('0x1c')](_0x49db8d);return _0xa41004[_0x906a('0x23')](_0x906a('0x24'),_0x2a6e96+'-'+_0x4ad4bc+'/'+_0x971b1a)[_0x906a('0x1e')](_0x252f9f);}return null;};}function patchUpdates(_0x2f778d){return function(_0xf10c72){try{jsonpatch[_0x906a('0x25')](_0xf10c72,_0x2f778d,!![]);}catch(_0x3c96bc){return BPromise[_0x906a('0x26')](_0x3c96bc);}return _0xf10c72[_0x906a('0x27')]();};}function saveUpdates(_0x192bd0,_0x2e1e68){return function(_0x5d8fc0){if(_0x5d8fc0){return _0x5d8fc0['update'](_0x192bd0)[_0x906a('0x28')](function(_0x324df2){return _0x324df2;});}return null;};}function removeEntity(_0x9f5f9b,_0x1e37f2){return function(_0x1cbc3c){if(_0x1cbc3c){return _0x1cbc3c[_0x906a('0x29')]()[_0x906a('0x28')](function(){_0x9f5f9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ffec2,_0xda31cc){return function(_0x36dc19){if(!_0x36dc19){_0x2ffec2[_0x906a('0x1b')](0x194);}return _0x36dc19;};}function handleError(_0x1782c3,_0x36ee71){_0x36ee71=_0x36ee71||0x1f4;return function(_0x2ea49c){logger['error'](_0x2ea49c['stack']);if(_0x2ea49c[_0x906a('0x2a')]){delete _0x2ea49c[_0x906a('0x2a')];}_0x1782c3[_0x906a('0x1c')](_0x36ee71)[_0x906a('0x2b')](_0x2ea49c);};}exports[_0x906a('0x2c')]=function(_0x42605a,_0x15b6ae){var _0x28a647={},_0x40618e={},_0x555a45={'count':0x0,'rows':[]};var _0x5c3696=_['map'](db[_0x906a('0x2d')][_0x906a('0x2e')],function(_0x2cf516){return{'name':_0x2cf516[_0x906a('0x2f')],'type':_0x2cf516['type'][_0x906a('0x30')]};});_0x40618e[_0x906a('0x31')]=_[_0x906a('0x32')](_0x5c3696,_0x906a('0x2a'));_0x40618e[_0x906a('0x33')]=_[_0x906a('0x34')](_0x42605a['query']);_0x40618e[_0x906a('0x35')]=_[_0x906a('0x36')](_0x40618e['model'],_0x40618e['query']);_0x28a647[_0x906a('0x37')]=_[_0x906a('0x36')](_0x40618e[_0x906a('0x31')],qs[_0x906a('0x38')](_0x42605a[_0x906a('0x33')]['fields']));_0x28a647[_0x906a('0x37')]=_0x28a647[_0x906a('0x37')][_0x906a('0x39')]?_0x28a647['attributes']:_0x40618e[_0x906a('0x31')];if(!_0x42605a[_0x906a('0x33')][_0x906a('0x3a')](_0x906a('0x3b'))){_0x28a647[_0x906a('0x21')]=qs[_0x906a('0x21')](_0x42605a['query'][_0x906a('0x21')]);_0x28a647[_0x906a('0x1f')]=qs[_0x906a('0x1f')](_0x42605a['query'][_0x906a('0x1f')]);}_0x28a647[_0x906a('0x3c')]=qs[_0x906a('0x3d')](_0x42605a[_0x906a('0x33')]['sort']);_0x28a647[_0x906a('0x3e')]=qs[_0x906a('0x35')](_['pick'](_0x42605a[_0x906a('0x33')],_0x40618e['filters']),_0x5c3696);if(_0x42605a[_0x906a('0x33')]['filter']){_0x28a647[_0x906a('0x3e')]=_[_0x906a('0x3f')](_0x28a647[_0x906a('0x3e')],{'$or':_[_0x906a('0x32')](_0x5c3696,function(_0x2ffd94){if(_0x2ffd94[_0x906a('0x40')]!==_0x906a('0x41')){var _0x3db4b3={};_0x3db4b3[_0x2ffd94[_0x906a('0x2a')]]={'$like':'%'+_0x42605a[_0x906a('0x33')][_0x906a('0x42')]+'%'};return _0x3db4b3;}})});}_0x28a647=_[_0x906a('0x3f')]({},_0x28a647,_0x42605a['options']);var _0xe9838a={'where':_0x28a647[_0x906a('0x3e')]};return db[_0x906a('0x2d')][_0x906a('0x22')](_0xe9838a)[_0x906a('0x28')](function(_0x27e68b){_0x555a45['count']=_0x27e68b;if(_0x42605a[_0x906a('0x33')][_0x906a('0x43')]){_0x28a647[_0x906a('0x44')]=[{'all':!![]}];}return db['ZohoField'][_0x906a('0x45')](_0x28a647);})[_0x906a('0x28')](function(_0x588da9){_0x555a45['rows']=_0x588da9;return _0x555a45;})['then'](respondWithFilteredResult(_0x15b6ae,_0x28a647))['catch'](handleError(_0x15b6ae,null));};exports[_0x906a('0x46')]=function(_0x48f7a2,_0x3676f4){var _0x24cf6e={'raw':!![],'where':{'id':_0x48f7a2[_0x906a('0x47')]['id']}},_0x2637c7={};_0x2637c7[_0x906a('0x31')]=_[_0x906a('0x34')](db[_0x906a('0x2d')]['rawAttributes']);_0x2637c7[_0x906a('0x33')]=_['keys'](_0x48f7a2[_0x906a('0x33')]);_0x2637c7[_0x906a('0x35')]=_[_0x906a('0x36')](_0x2637c7[_0x906a('0x31')],_0x2637c7[_0x906a('0x33')]);_0x24cf6e[_0x906a('0x37')]=_[_0x906a('0x36')](_0x2637c7[_0x906a('0x31')],qs['fields'](_0x48f7a2[_0x906a('0x33')][_0x906a('0x38')]));_0x24cf6e[_0x906a('0x37')]=_0x24cf6e[_0x906a('0x37')][_0x906a('0x39')]?_0x24cf6e[_0x906a('0x37')]:_0x2637c7[_0x906a('0x31')];if(_0x48f7a2[_0x906a('0x33')][_0x906a('0x43')]){_0x24cf6e['include']=[{'all':!![]}];}_0x24cf6e=_[_0x906a('0x3f')]({},_0x24cf6e,_0x48f7a2[_0x906a('0x48')]);return db['ZohoField'][_0x906a('0x49')](_0x24cf6e)[_0x906a('0x28')](handleEntityNotFound(_0x3676f4,null))['then'](respondWithResult(_0x3676f4,null))[_0x906a('0x4a')](handleError(_0x3676f4,null));};exports['create']=function(_0x8fa7b0,_0x2a1c42){return db[_0x906a('0x2d')][_0x906a('0x4b')](_0x8fa7b0['body'],{})['then'](respondWithResult(_0x2a1c42,0xc9))[_0x906a('0x4a')](handleError(_0x2a1c42,null));};exports[_0x906a('0x4c')]=function(_0x37be48,_0x2a3053){if(_0x37be48[_0x906a('0x4d')]['id']){delete _0x37be48[_0x906a('0x4d')]['id'];}return db[_0x906a('0x2d')][_0x906a('0x49')]({'where':{'id':_0x37be48[_0x906a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a3053,null))[_0x906a('0x28')](saveUpdates(_0x37be48[_0x906a('0x4d')],null))[_0x906a('0x28')](respondWithResult(_0x2a3053,null))[_0x906a('0x4a')](handleError(_0x2a3053,null));};exports[_0x906a('0x29')]=function(_0xac4212,_0x5dc1f1){return db[_0x906a('0x2d')][_0x906a('0x49')]({'where':{'id':_0xac4212[_0x906a('0x47')]['id']}})[_0x906a('0x28')](handleEntityNotFound(_0x5dc1f1,null))[_0x906a('0x28')](removeEntity(_0x5dc1f1,null))[_0x906a('0x4a')](handleError(_0x5dc1f1,null));};
\ No newline at end of file