Built motion from commit (unavailable).|2.3.1
[motion2.git] / server / api / intZohoField / intZohoField.controller.js
index b990c38..4a56f18 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd404=['path','sox','to-csv','ejs','lodash','crypto','jsforce','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','save','update','then','end','stack','name','send','index','ZohoField','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','field','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x5e1eb2,_0x34c6af){var _0x849ba3=function(_0x3f0808){while(--_0x3f0808){_0x5e1eb2['push'](_0x5e1eb2['shift']());}};_0x849ba3(++_0x34c6af);}(_0xd404,0x15b));var _0x4d40=function(_0x3f9310,_0x22d770){_0x3f9310=_0x3f9310-0x0;var _0x2de91f=_0xd404[_0x3f9310];return _0x2de91f;};'use strict';var pdf=require(_0x4d40('0x0'));var emlformat=require(_0x4d40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d40('0x2'));var jsonpatch=require(_0x4d40('0x3'));var rp=require('request-promise');var moment=require(_0x4d40('0x4'));var BPromise=require(_0x4d40('0x5'));var Mustache=require(_0x4d40('0x6'));var util=require(_0x4d40('0x7'));var path=require(_0x4d40('0x8'));var sox=require(_0x4d40('0x9'));var csv=require(_0x4d40('0xa'));var ejs=require(_0x4d40('0xb'));var fs=require('fs');var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x4d40('0xf'));var hardwareService=require(_0x4d40('0x10'));var Redis=require(_0x4d40('0x11'));var qs=require(_0x4d40('0x12'));var logger=require(_0x4d40('0x13'))(_0x4d40('0x14'));var utils=require(_0x4d40('0x15'));var config=require(_0x4d40('0x16'));var db=require(_0x4d40('0x17'))['db'];function respondWithStatusCode(_0x3f5c29,_0x44b5d0){_0x44b5d0=_0x44b5d0||0xcc;return function(_0x3c3b7e){if(_0x3c3b7e){return _0x3f5c29[_0x4d40('0x18')](_0x44b5d0);}return _0x3f5c29[_0x4d40('0x19')](_0x44b5d0)['end']();};}function respondWithResult(_0xa644d2,_0x1bed4c){_0x1bed4c=_0x1bed4c||0xc8;return function(_0x3b071b){if(_0x3b071b){return _0xa644d2[_0x4d40('0x19')](_0x1bed4c)[_0x4d40('0x1a')](_0x3b071b);}};}function respondWithFilteredResult(_0x478cdd,_0x23de7b){return function(_0x4077ce){if(_0x4077ce){var _0x20bc1b=_0x4077ce[_0x4d40('0x1b')],_0xcee25a=_0x23de7b[_0x4d40('0x1c')],_0x453857=_0x23de7b[_0x4d40('0x1c')]+_0x23de7b['limit'],_0x361a41;if(_0x453857>=_0x20bc1b){_0x453857=_0x20bc1b;_0x361a41=0xc8;}else{_0x361a41=0xce;}_0x478cdd['status'](_0x361a41);return _0x478cdd[_0x4d40('0x1d')](_0x4d40('0x1e'),_0xcee25a+'-'+_0x453857+'/'+_0x20bc1b)['json'](_0x4077ce);}return null;};}function patchUpdates(_0x23b8fd){return function(_0x803d26){try{jsonpatch['apply'](_0x803d26,_0x23b8fd,!![]);}catch(_0x36d031){return BPromise['reject'](_0x36d031);}return _0x803d26[_0x4d40('0x1f')]();};}function saveUpdates(_0x42618b,_0x5230b4){return function(_0x57c997){if(_0x57c997){return _0x57c997[_0x4d40('0x20')](_0x42618b)[_0x4d40('0x21')](function(_0x4d52ce){return _0x4d52ce;});}return null;};}function removeEntity(_0xc458da,_0x3684eb){return function(_0x30f058){if(_0x30f058){return _0x30f058['destroy']()[_0x4d40('0x21')](function(){_0xc458da[_0x4d40('0x19')](0xcc)[_0x4d40('0x22')]();});}};}function handleEntityNotFound(_0x5ca0a0,_0x4eebc3){return function(_0x2df33a){if(!_0x2df33a){_0x5ca0a0[_0x4d40('0x18')](0x194);}return _0x2df33a;};}function handleError(_0x1285f6,_0x470411){_0x470411=_0x470411||0x1f4;return function(_0x4677c9){logger['error'](_0x4677c9[_0x4d40('0x23')]);if(_0x4677c9[_0x4d40('0x24')]){delete _0x4677c9['name'];}_0x1285f6['status'](_0x470411)[_0x4d40('0x25')](_0x4677c9);};}exports[_0x4d40('0x26')]=function(_0x3fa83e,_0x3ad1d7){var _0x4a8ad6={},_0x325f6f={},_0x105635={'count':0x0,'rows':[]};var _0x35dd32=db[_0x4d40('0x27')][_0x4d40('0x28')];_0x325f6f[_0x4d40('0x29')]=_['keys'](_0x35dd32);_0x325f6f['query']=_['keys'](_0x3fa83e[_0x4d40('0x2a')]);_0x325f6f[_0x4d40('0x2b')]=_[_0x4d40('0x2c')](_0x325f6f[_0x4d40('0x29')],_0x325f6f['query']);_0x4a8ad6[_0x4d40('0x2d')]=_[_0x4d40('0x2c')](_0x325f6f[_0x4d40('0x29')],qs['fields'](_0x3fa83e[_0x4d40('0x2a')][_0x4d40('0x2e')]));_0x4a8ad6[_0x4d40('0x2d')]=_0x4a8ad6[_0x4d40('0x2d')][_0x4d40('0x2f')]?_0x4a8ad6['attributes']:_0x325f6f[_0x4d40('0x29')];if(!_0x3fa83e['query'][_0x4d40('0x30')](_0x4d40('0x31'))){_0x4a8ad6[_0x4d40('0x32')]=qs[_0x4d40('0x32')](_0x3fa83e['query']['limit']);_0x4a8ad6[_0x4d40('0x1c')]=qs[_0x4d40('0x1c')](_0x3fa83e[_0x4d40('0x2a')][_0x4d40('0x1c')]);}_0x4a8ad6['order']=qs[_0x4d40('0x33')](_0x3fa83e['query'][_0x4d40('0x33')]);_0x4a8ad6[_0x4d40('0x34')]=qs[_0x4d40('0x2b')](_[_0x4d40('0x35')](_0x3fa83e[_0x4d40('0x2a')],_0x325f6f[_0x4d40('0x2b')]));if(_0x3fa83e[_0x4d40('0x2a')][_0x4d40('0x36')]){_0x4a8ad6[_0x4d40('0x34')]=_[_0x4d40('0x37')](_0x4a8ad6['where'],{'$or':_[_0x4d40('0x38')](_0x35dd32,function(_0x2c020e){if(_0x2c020e['type']['key']!=='VIRTUAL'){var _0x246b9f={};_0x246b9f[_0x2c020e[_0x4d40('0x39')]]={'$like':'%'+_0x3fa83e['query'][_0x4d40('0x36')]+'%'};return _0x246b9f;}})});}_0x4a8ad6=_[_0x4d40('0x37')]({},_0x4a8ad6,_0x3fa83e[_0x4d40('0x3a')]);var _0x3c5451={'where':_0x4a8ad6[_0x4d40('0x34')]};return db['ZohoField'][_0x4d40('0x1b')](_0x3c5451)[_0x4d40('0x21')](function(_0x4a84fa){_0x105635['count']=_0x4a84fa;if(_0x3fa83e[_0x4d40('0x2a')][_0x4d40('0x3b')]){_0x4a8ad6['include']=[{'all':!![]}];}return db[_0x4d40('0x27')][_0x4d40('0x3c')](_0x4a8ad6);})['then'](function(_0x1e8427){_0x105635[_0x4d40('0x3d')]=_0x1e8427;return _0x105635;})['then'](respondWithFilteredResult(_0x3ad1d7,_0x4a8ad6))[_0x4d40('0x3e')](handleError(_0x3ad1d7,null));};exports[_0x4d40('0x3f')]=function(_0x4841ac,_0x2b5db0){var _0x55cdf4={'raw':!![],'where':{'id':_0x4841ac[_0x4d40('0x40')]['id']}},_0x2ec933={};_0x2ec933[_0x4d40('0x29')]=_[_0x4d40('0x41')](db[_0x4d40('0x27')][_0x4d40('0x28')]);_0x2ec933[_0x4d40('0x2a')]=_[_0x4d40('0x41')](_0x4841ac[_0x4d40('0x2a')]);_0x2ec933['filters']=_[_0x4d40('0x2c')](_0x2ec933[_0x4d40('0x29')],_0x2ec933[_0x4d40('0x2a')]);_0x55cdf4[_0x4d40('0x2d')]=_[_0x4d40('0x2c')](_0x2ec933['model'],qs[_0x4d40('0x2e')](_0x4841ac['query'][_0x4d40('0x2e')]));_0x55cdf4[_0x4d40('0x2d')]=_0x55cdf4[_0x4d40('0x2d')][_0x4d40('0x2f')]?_0x55cdf4['attributes']:_0x2ec933[_0x4d40('0x29')];if(_0x4841ac[_0x4d40('0x2a')]['includeAll']){_0x55cdf4[_0x4d40('0x42')]=[{'all':!![]}];}_0x55cdf4=_['merge']({},_0x55cdf4,_0x4841ac[_0x4d40('0x3a')]);return db[_0x4d40('0x27')][_0x4d40('0x43')](_0x55cdf4)[_0x4d40('0x21')](handleEntityNotFound(_0x2b5db0,null))['then'](respondWithResult(_0x2b5db0,null))[_0x4d40('0x3e')](handleError(_0x2b5db0,null));};exports['create']=function(_0x2f03cb,_0x465af2){return db[_0x4d40('0x27')][_0x4d40('0x44')](_0x2f03cb['body'],{})[_0x4d40('0x21')](respondWithResult(_0x465af2,0xc9))[_0x4d40('0x3e')](handleError(_0x465af2,null));};exports[_0x4d40('0x20')]=function(_0x363fcc,_0x4990f9){if(_0x363fcc[_0x4d40('0x45')]['id']){delete _0x363fcc[_0x4d40('0x45')]['id'];}return db['ZohoField'][_0x4d40('0x43')]({'where':{'id':_0x363fcc['params']['id']}})[_0x4d40('0x21')](handleEntityNotFound(_0x4990f9,null))[_0x4d40('0x21')](saveUpdates(_0x363fcc[_0x4d40('0x45')],null))[_0x4d40('0x21')](respondWithResult(_0x4990f9,null))[_0x4d40('0x3e')](handleError(_0x4990f9,null));};exports[_0x4d40('0x46')]=function(_0x30be7b,_0x37b6bf){return db[_0x4d40('0x27')]['find']({'where':{'id':_0x30be7b[_0x4d40('0x40')]['id']}})[_0x4d40('0x21')](handleEntityNotFound(_0x37b6bf,null))[_0x4d40('0x21')](removeEntity(_0x37b6bf,null))[_0x4d40('0x3e')](handleError(_0x37b6bf,null));};
\ No newline at end of file
+var _0xbfc0=['filters','map','type','key','VIRTUAL','field','filter','merge','where','then','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','lodash','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','error','stack','name','send','index','ZohoField','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xbfc0,0x115));var _0x0bfc=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0xbfc0[_0x263a2f];return _0x8020e8;};'use strict';var pdf=require(_0x0bfc('0x0'));var emlformat=require(_0x0bfc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0bfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bfc('0x3'));var moment=require(_0x0bfc('0x4'));var BPromise=require(_0x0bfc('0x5'));var Mustache=require('mustache');var util=require(_0x0bfc('0x6'));var path=require(_0x0bfc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0bfc('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bfc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0bfc('0xa'));var querystring=require(_0x0bfc('0xb'));var Papa=require(_0x0bfc('0xc'));var authService=require(_0x0bfc('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x0bfc('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x0bfc('0xf'));var config=require('../../config/environment');var db=require(_0x0bfc('0x10'))['db'];function respondWithStatusCode(_0x29cf86,_0x9ee167){_0x9ee167=_0x9ee167||0xcc;return function(_0x259b30){if(_0x259b30){return _0x29cf86[_0x0bfc('0x11')](_0x9ee167);}return _0x29cf86[_0x0bfc('0x12')](_0x9ee167)[_0x0bfc('0x13')]();};}function respondWithResult(_0x399c1a,_0x3155e1){_0x3155e1=_0x3155e1||0xc8;return function(_0x357c45){if(_0x357c45){return _0x399c1a[_0x0bfc('0x12')](_0x3155e1)[_0x0bfc('0x14')](_0x357c45);}};}function respondWithFilteredResult(_0x1b8e46,_0x4e06cd){return function(_0x31babe){if(_0x31babe){var _0x434f33=_0x31babe[_0x0bfc('0x15')],_0x5971fb=_0x4e06cd[_0x0bfc('0x16')],_0x40f312=_0x4e06cd['offset']+_0x4e06cd[_0x0bfc('0x17')],_0x1defb0;if(_0x40f312>=_0x434f33){_0x40f312=_0x434f33;_0x1defb0=0xc8;}else{_0x1defb0=0xce;}_0x1b8e46['status'](_0x1defb0);return _0x1b8e46['set']('Content-Range',_0x5971fb+'-'+_0x40f312+'/'+_0x434f33)[_0x0bfc('0x14')](_0x31babe);}return null;};}function patchUpdates(_0x3933aa){return function(_0x408e67){try{jsonpatch[_0x0bfc('0x18')](_0x408e67,_0x3933aa,!![]);}catch(_0x4b7dfd){return BPromise['reject'](_0x4b7dfd);}return _0x408e67[_0x0bfc('0x19')]();};}function saveUpdates(_0x5a5c00,_0x109a05){return function(_0x316e70){if(_0x316e70){return _0x316e70[_0x0bfc('0x1a')](_0x5a5c00)['then'](function(_0x575700){return _0x575700;});}return null;};}function removeEntity(_0x4a8225,_0x488f3d){return function(_0x13a8a0){if(_0x13a8a0){return _0x13a8a0['destroy']()['then'](function(){_0x4a8225[_0x0bfc('0x12')](0xcc)[_0x0bfc('0x13')]();});}};}function handleEntityNotFound(_0x45bda4,_0x3928b2){return function(_0x2fe950){if(!_0x2fe950){_0x45bda4[_0x0bfc('0x11')](0x194);}return _0x2fe950;};}function handleError(_0x518a5b,_0x1d665a){_0x1d665a=_0x1d665a||0x1f4;return function(_0x26db58){logger[_0x0bfc('0x1b')](_0x26db58[_0x0bfc('0x1c')]);if(_0x26db58[_0x0bfc('0x1d')]){delete _0x26db58[_0x0bfc('0x1d')];}_0x518a5b[_0x0bfc('0x12')](_0x1d665a)[_0x0bfc('0x1e')](_0x26db58);};}exports[_0x0bfc('0x1f')]=function(_0x2f704b,_0x4b56ff){var _0x50c7cb={},_0xe9452d={},_0x469199={'count':0x0,'rows':[]};var _0x3616f1=db[_0x0bfc('0x20')][_0x0bfc('0x21')];_0xe9452d['model']=_[_0x0bfc('0x22')](_0x3616f1);_0xe9452d[_0x0bfc('0x23')]=_[_0x0bfc('0x22')](_0x2f704b[_0x0bfc('0x23')]);_0xe9452d['filters']=_[_0x0bfc('0x24')](_0xe9452d[_0x0bfc('0x25')],_0xe9452d['query']);_0x50c7cb[_0x0bfc('0x26')]=_[_0x0bfc('0x24')](_0xe9452d[_0x0bfc('0x25')],qs[_0x0bfc('0x27')](_0x2f704b[_0x0bfc('0x23')]['fields']));_0x50c7cb[_0x0bfc('0x26')]=_0x50c7cb['attributes'][_0x0bfc('0x28')]?_0x50c7cb[_0x0bfc('0x26')]:_0xe9452d[_0x0bfc('0x25')];if(!_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x29')]('nolimit')){_0x50c7cb[_0x0bfc('0x17')]=qs[_0x0bfc('0x17')](_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x17')]);_0x50c7cb[_0x0bfc('0x16')]=qs[_0x0bfc('0x16')](_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x16')]);}_0x50c7cb['order']=qs[_0x0bfc('0x2a')](_0x2f704b['query'][_0x0bfc('0x2a')]);_0x50c7cb['where']=qs['filters'](_['pick'](_0x2f704b[_0x0bfc('0x23')],_0xe9452d[_0x0bfc('0x2b')]));if(_0x2f704b[_0x0bfc('0x23')]['filter']){_0x50c7cb['where']=_['merge'](_0x50c7cb['where'],{'$or':_[_0x0bfc('0x2c')](_0x3616f1,function(_0x3a9ec1){if(_0x3a9ec1[_0x0bfc('0x2d')][_0x0bfc('0x2e')]!==_0x0bfc('0x2f')){var _0x4cb955={};_0x4cb955[_0x3a9ec1[_0x0bfc('0x30')]]={'$like':'%'+_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x31')]+'%'};return _0x4cb955;}})});}_0x50c7cb=_[_0x0bfc('0x32')]({},_0x50c7cb,_0x2f704b['options']);var _0x4281b1={'where':_0x50c7cb[_0x0bfc('0x33')]};return db[_0x0bfc('0x20')][_0x0bfc('0x15')](_0x4281b1)[_0x0bfc('0x34')](function(_0x2afa14){_0x469199[_0x0bfc('0x15')]=_0x2afa14;if(_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x35')]){_0x50c7cb[_0x0bfc('0x36')]=[{'all':!![]}];}return db['ZohoField'][_0x0bfc('0x37')](_0x50c7cb);})[_0x0bfc('0x34')](function(_0x579e9f){_0x469199['rows']=_0x579e9f;return _0x469199;})['then'](respondWithFilteredResult(_0x4b56ff,_0x50c7cb))[_0x0bfc('0x38')](handleError(_0x4b56ff,null));};exports[_0x0bfc('0x39')]=function(_0x3d8e32,_0x23ed14){var _0x1bdb2d={'raw':!![],'where':{'id':_0x3d8e32[_0x0bfc('0x3a')]['id']}},_0x37a19b={};_0x37a19b[_0x0bfc('0x25')]=_[_0x0bfc('0x22')](db[_0x0bfc('0x20')][_0x0bfc('0x21')]);_0x37a19b['query']=_[_0x0bfc('0x22')](_0x3d8e32[_0x0bfc('0x23')]);_0x37a19b[_0x0bfc('0x2b')]=_[_0x0bfc('0x24')](_0x37a19b[_0x0bfc('0x25')],_0x37a19b[_0x0bfc('0x23')]);_0x1bdb2d['attributes']=_['intersection'](_0x37a19b['model'],qs[_0x0bfc('0x27')](_0x3d8e32[_0x0bfc('0x23')][_0x0bfc('0x27')]));_0x1bdb2d['attributes']=_0x1bdb2d[_0x0bfc('0x26')][_0x0bfc('0x28')]?_0x1bdb2d[_0x0bfc('0x26')]:_0x37a19b[_0x0bfc('0x25')];if(_0x3d8e32[_0x0bfc('0x23')][_0x0bfc('0x35')]){_0x1bdb2d[_0x0bfc('0x36')]=[{'all':!![]}];}_0x1bdb2d=_[_0x0bfc('0x32')]({},_0x1bdb2d,_0x3d8e32[_0x0bfc('0x3b')]);return db[_0x0bfc('0x20')][_0x0bfc('0x3c')](_0x1bdb2d)[_0x0bfc('0x34')](handleEntityNotFound(_0x23ed14,null))[_0x0bfc('0x34')](respondWithResult(_0x23ed14,null))[_0x0bfc('0x38')](handleError(_0x23ed14,null));};exports[_0x0bfc('0x3d')]=function(_0x2d21ed,_0x4f1ebf){return db[_0x0bfc('0x20')][_0x0bfc('0x3d')](_0x2d21ed[_0x0bfc('0x3e')],{})[_0x0bfc('0x34')](respondWithResult(_0x4f1ebf,0xc9))[_0x0bfc('0x38')](handleError(_0x4f1ebf,null));};exports['update']=function(_0x50b414,_0x25f3cd){if(_0x50b414[_0x0bfc('0x3e')]['id']){delete _0x50b414[_0x0bfc('0x3e')]['id'];}return db['ZohoField'][_0x0bfc('0x3c')]({'where':{'id':_0x50b414[_0x0bfc('0x3a')]['id']}})[_0x0bfc('0x34')](handleEntityNotFound(_0x25f3cd,null))[_0x0bfc('0x34')](saveUpdates(_0x50b414[_0x0bfc('0x3e')],null))[_0x0bfc('0x34')](respondWithResult(_0x25f3cd,null))[_0x0bfc('0x38')](handleError(_0x25f3cd,null));};exports[_0x0bfc('0x3f')]=function(_0x15025d,_0x398b43){return db[_0x0bfc('0x20')]['find']({'where':{'id':_0x15025d['params']['id']}})[_0x0bfc('0x34')](handleEntityNotFound(_0x398b43,null))[_0x0bfc('0x34')](removeEntity(_0x398b43,null))[_0x0bfc('0x38')](handleError(_0x398b43,null));};
\ No newline at end of file