Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / api / intZohoConfiguration / intZohoConfiguration.controller.js
index 2bb881e..dbdab0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22e0=['reject','save','then','error','stack','name','send','index','map','ZohoConfiguration','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','length','include','find','create','body','update','destroy','findOne','ZohoField','rawAttributes','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json'];(function(_0x3d2879,_0x525685){var _0x558e60=function(_0x48c66d){while(--_0x48c66d){_0x3d2879['push'](_0x3d2879['shift']());}};_0x558e60(++_0x525685);}(_0x22e0,0x7e));var _0x022e=function(_0x4aae38,_0x5e79a8){_0x4aae38=_0x4aae38-0x0;var _0x2077c9=_0x22e0[_0x4aae38];return _0x2077c9;};'use strict';var emlformat=require(_0x022e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x022e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x022e('0x2'));var moment=require(_0x022e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x022e('0x4'));var util=require(_0x022e('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x022e('0x6'));var _=require(_0x022e('0x7'));var squel=require(_0x022e('0x8'));var crypto=require(_0x022e('0x9'));var jsforce=require(_0x022e('0xa'));var deskjs=require(_0x022e('0xb'));var toCsv=require(_0x022e('0xc'));var querystring=require(_0x022e('0xd'));var Papa=require('papaparse');var Redis=require(_0x022e('0xe'));var authService=require(_0x022e('0xf'));var qs=require(_0x022e('0x10'));var as=require(_0x022e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x022e('0x12'))(_0x022e('0x13'));var utils=require(_0x022e('0x14'));var config=require(_0x022e('0x15'));var licenseUtil=require(_0x022e('0x16'));var db=require(_0x022e('0x17'))['db'];function respondWithStatusCode(_0x775c03,_0x3e1c16){_0x3e1c16=_0x3e1c16||0xcc;return function(_0x8f7e4f){if(_0x8f7e4f){return _0x775c03[_0x022e('0x18')](_0x3e1c16);}return _0x775c03[_0x022e('0x19')](_0x3e1c16)[_0x022e('0x1a')]();};}function respondWithResult(_0x3417a1,_0x2395a7){_0x2395a7=_0x2395a7||0xc8;return function(_0x44e491){if(_0x44e491){return _0x3417a1[_0x022e('0x19')](_0x2395a7)['json'](_0x44e491);}};}function respondWithFilteredResult(_0x12e8ff,_0xa4f46a){return function(_0x3fd35f){if(_0x3fd35f){var _0x19261c=typeof _0xa4f46a[_0x022e('0x1b')]===_0x022e('0x1c')&&typeof _0xa4f46a[_0x022e('0x1d')]===_0x022e('0x1c');var _0x56039a=_0x3fd35f[_0x022e('0x1e')];var _0xbbe108=_0x19261c?0x0:_0xa4f46a[_0x022e('0x1b')];var _0xec96d6=_0x19261c?_0x3fd35f['count']:_0xa4f46a['offset']+_0xa4f46a['limit'];var _0x4ecde3;if(_0xec96d6>=_0x56039a){_0xec96d6=_0x56039a;_0x4ecde3=0xc8;}else{_0x4ecde3=0xce;}_0x12e8ff[_0x022e('0x19')](_0x4ecde3);return _0x12e8ff['set']('Content-Range',_0xbbe108+'-'+_0xec96d6+'/'+_0x56039a)[_0x022e('0x1f')](_0x3fd35f);}return null;};}function patchUpdates(_0x1cf8ef){return function(_0x239036){try{jsonpatch['apply'](_0x239036,_0x1cf8ef,!![]);}catch(_0x4cc080){return BPromise[_0x022e('0x20')](_0x4cc080);}return _0x239036[_0x022e('0x21')]();};}function saveUpdates(_0x31637b,_0x599ac9){return function(_0x2b3b4c){if(_0x2b3b4c){return _0x2b3b4c['update'](_0x31637b)[_0x022e('0x22')](function(_0x389aeb){return _0x389aeb;});}return null;};}function removeEntity(_0x219bcc,_0x2d735d){return function(_0x1b187d){if(_0x1b187d){return _0x1b187d['destroy']()[_0x022e('0x22')](function(){_0x219bcc[_0x022e('0x19')](0xcc)[_0x022e('0x1a')]();});}};}function handleEntityNotFound(_0x3d81be,_0x3aebbe){return function(_0x27f7ed){if(!_0x27f7ed){_0x3d81be['sendStatus'](0x194);}return _0x27f7ed;};}function handleError(_0x2c8356,_0x39314a){_0x39314a=_0x39314a||0x1f4;return function(_0x499f0f){logger[_0x022e('0x23')](_0x499f0f[_0x022e('0x24')]);if(_0x499f0f['name']){delete _0x499f0f[_0x022e('0x25')];}_0x2c8356[_0x022e('0x19')](_0x39314a)[_0x022e('0x26')](_0x499f0f);};}exports[_0x022e('0x27')]=function(_0x2b1f7b,_0x33fb3e){var _0x3ee386={},_0x1223c4={},_0x5463e5={'count':0x0,'rows':[]};var _0x49e7b4=_[_0x022e('0x28')](db[_0x022e('0x29')]['rawAttributes'],function(_0x7c1a85){return{'name':_0x7c1a85['fieldName'],'type':_0x7c1a85['type'][_0x022e('0x2a')]};});_0x1223c4[_0x022e('0x2b')]=_[_0x022e('0x28')](_0x49e7b4,'name');_0x1223c4[_0x022e('0x2c')]=_[_0x022e('0x2d')](_0x2b1f7b['query']);_0x1223c4[_0x022e('0x2e')]=_['intersection'](_0x1223c4[_0x022e('0x2b')],_0x1223c4[_0x022e('0x2c')]);_0x3ee386['attributes']=_[_0x022e('0x2f')](_0x1223c4[_0x022e('0x2b')],qs['fields'](_0x2b1f7b['query']['fields']));_0x3ee386[_0x022e('0x30')]=_0x3ee386[_0x022e('0x30')]['length']?_0x3ee386['attributes']:_0x1223c4['model'];if(!_0x2b1f7b[_0x022e('0x2c')]['hasOwnProperty'](_0x022e('0x31'))){_0x3ee386[_0x022e('0x1d')]=qs['limit'](_0x2b1f7b[_0x022e('0x2c')][_0x022e('0x1d')]);_0x3ee386[_0x022e('0x1b')]=qs[_0x022e('0x1b')](_0x2b1f7b[_0x022e('0x2c')][_0x022e('0x1b')]);}_0x3ee386[_0x022e('0x32')]=qs['sort'](_0x2b1f7b[_0x022e('0x2c')][_0x022e('0x33')]);_0x3ee386[_0x022e('0x34')]=qs['filters'](_['pick'](_0x2b1f7b[_0x022e('0x2c')],_0x1223c4[_0x022e('0x2e')]),_0x49e7b4);if(_0x2b1f7b[_0x022e('0x2c')][_0x022e('0x35')]){_0x3ee386[_0x022e('0x34')]=_[_0x022e('0x36')](_0x3ee386[_0x022e('0x34')],{'$or':_[_0x022e('0x28')](_0x49e7b4,function(_0x59d177){if(_0x59d177['type']!==_0x022e('0x37')){var _0x26ff8d={};_0x26ff8d[_0x59d177[_0x022e('0x25')]]={'$like':'%'+_0x2b1f7b[_0x022e('0x2c')][_0x022e('0x35')]+'%'};return _0x26ff8d;}})});}_0x3ee386=_[_0x022e('0x36')]({},_0x3ee386,_0x2b1f7b[_0x022e('0x38')]);var _0x4427b1={'where':_0x3ee386[_0x022e('0x34')]};return db[_0x022e('0x29')][_0x022e('0x1e')](_0x4427b1)['then'](function(_0x1dafce){_0x5463e5[_0x022e('0x1e')]=_0x1dafce;if(_0x2b1f7b['query'][_0x022e('0x39')]){_0x3ee386['include']=[{'all':!![]}];}return db[_0x022e('0x29')][_0x022e('0x3a')](_0x3ee386);})[_0x022e('0x22')](function(_0x67711e){_0x5463e5[_0x022e('0x3b')]=_0x67711e;return _0x5463e5;})[_0x022e('0x22')](respondWithFilteredResult(_0x33fb3e,_0x3ee386))[_0x022e('0x3c')](handleError(_0x33fb3e,null));};exports[_0x022e('0x3d')]=function(_0x1d3e61,_0x12e95b){var _0x1338e8={'raw':![],'where':{'id':_0x1d3e61[_0x022e('0x3e')]['id']}},_0x31c842={};_0x31c842[_0x022e('0x2b')]=_[_0x022e('0x2d')](db[_0x022e('0x29')]['rawAttributes']);_0x31c842['query']=_[_0x022e('0x2d')](_0x1d3e61[_0x022e('0x2c')]);_0x31c842[_0x022e('0x2e')]=_[_0x022e('0x2f')](_0x31c842['model'],_0x31c842[_0x022e('0x2c')]);_0x1338e8['attributes']=_[_0x022e('0x2f')](_0x31c842['model'],qs[_0x022e('0x3f')](_0x1d3e61[_0x022e('0x2c')][_0x022e('0x3f')]));_0x1338e8[_0x022e('0x30')]=_0x1338e8[_0x022e('0x30')][_0x022e('0x40')]?_0x1338e8[_0x022e('0x30')]:_0x31c842['model'];if(_0x1d3e61[_0x022e('0x2c')][_0x022e('0x39')]){_0x1338e8[_0x022e('0x41')]=[{'all':!![]}];}_0x1338e8=_[_0x022e('0x36')]({},_0x1338e8,_0x1d3e61[_0x022e('0x38')]);return db[_0x022e('0x29')][_0x022e('0x42')](_0x1338e8)[_0x022e('0x22')](handleEntityNotFound(_0x12e95b,null))['then'](respondWithResult(_0x12e95b,null))[_0x022e('0x3c')](handleError(_0x12e95b,null));};exports['create']=function(_0x40c36b,_0x38beb8){return db[_0x022e('0x29')][_0x022e('0x43')](_0x40c36b[_0x022e('0x44')],{})[_0x022e('0x22')](respondWithResult(_0x38beb8,0xc9))[_0x022e('0x3c')](handleError(_0x38beb8,null));};exports[_0x022e('0x45')]=function(_0xb4aa00,_0x16d426){if(_0xb4aa00['body']['id']){delete _0xb4aa00[_0x022e('0x44')]['id'];}return db[_0x022e('0x29')][_0x022e('0x42')]({'where':{'id':_0xb4aa00['params']['id']}})[_0x022e('0x22')](handleEntityNotFound(_0x16d426,null))[_0x022e('0x22')](saveUpdates(_0xb4aa00[_0x022e('0x44')],null))[_0x022e('0x22')](respondWithResult(_0x16d426,null))[_0x022e('0x3c')](handleError(_0x16d426,null));};exports[_0x022e('0x46')]=function(_0x2309c5,_0x4657c9){return db[_0x022e('0x29')][_0x022e('0x42')]({'where':{'id':_0x2309c5[_0x022e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4657c9,null))['then'](removeEntity(_0x4657c9,null))[_0x022e('0x3c')](handleError(_0x4657c9,null));};exports['getFields']=function(_0x52c630,_0x530124,_0x28eecb){var _0xd7dcaa={};var _0x196827={};var _0x2f08ee;var _0x408934;return db[_0x022e('0x29')][_0x022e('0x47')]({'where':{'id':_0x52c630['params']['id']}})['then'](handleEntityNotFound(_0x530124,null))[_0x022e('0x22')](function(_0x2eddd3){if(_0x2eddd3){_0x2f08ee=_0x2eddd3;_0x196827['model']=_['keys'](db[_0x022e('0x48')][_0x022e('0x49')]);_0x196827['query']=_['keys'](_0x52c630[_0x022e('0x2c')]);_0x196827[_0x022e('0x2e')]=_['intersection'](_0x196827[_0x022e('0x2b')],_0x196827[_0x022e('0x2c')]);_0xd7dcaa['attributes']=_[_0x022e('0x2f')](_0x196827['model'],qs['fields'](_0x52c630[_0x022e('0x2c')]['fields']));_0xd7dcaa['attributes']=_0xd7dcaa[_0x022e('0x30')][_0x022e('0x40')]?_0xd7dcaa[_0x022e('0x30')]:_0x196827[_0x022e('0x2b')];_0xd7dcaa[_0x022e('0x32')]=qs[_0x022e('0x33')](_0x52c630[_0x022e('0x2c')]['sort']);_0xd7dcaa['where']=qs['filters'](_[_0x022e('0x4a')](_0x52c630[_0x022e('0x2c')],_0x196827[_0x022e('0x2e')]));if(_0x52c630[_0x022e('0x2c')][_0x022e('0x35')]){_0xd7dcaa['where']=_[_0x022e('0x36')](_0xd7dcaa[_0x022e('0x34')],{'$or':_[_0x022e('0x28')](_0xd7dcaa[_0x022e('0x30')],function(_0x1de509){var _0x1406cc={};_0x1406cc[_0x1de509]={'$like':'%'+_0x52c630[_0x022e('0x2c')][_0x022e('0x35')]+'%'};return _0x1406cc;})});}_0xd7dcaa=_[_0x022e('0x36')]({},_0xd7dcaa,_0x52c630[_0x022e('0x38')]);return _0x2f08ee[_0x022e('0x4b')](_0xd7dcaa);}})[_0x022e('0x22')](function(_0x1b319a){if(_0x1b319a){_0x408934=_0x1b319a[_0x022e('0x40')];if(!_0x52c630[_0x022e('0x2c')][_0x022e('0x4c')](_0x022e('0x31'))){_0xd7dcaa[_0x022e('0x1d')]=qs[_0x022e('0x1d')](_0x52c630[_0x022e('0x2c')][_0x022e('0x1d')]);_0xd7dcaa[_0x022e('0x1b')]=qs[_0x022e('0x1b')](_0x52c630[_0x022e('0x2c')][_0x022e('0x1b')]);}return _0x2f08ee[_0x022e('0x4b')](_0xd7dcaa);}})['then'](function(_0x2d257e){if(_0x2d257e){return _0x2d257e?{'count':_0x408934,'rows':_0x2d257e}:null;}})[_0x022e('0x22')](respondWithResult(_0x530124,null))[_0x022e('0x3c')](handleError(_0x530124,null));};exports[_0x022e('0x4d')]=function(_0x3a772f,_0x5923dc,_0x1b9d36){var _0x568a39={};var _0x5ecaeb={};var _0x5e6ddf;var _0x36604e;return db[_0x022e('0x29')][_0x022e('0x47')]({'where':{'id':_0x3a772f['params']['id']}})['then'](handleEntityNotFound(_0x5923dc,null))[_0x022e('0x22')](function(_0x2d161c){if(_0x2d161c){_0x5e6ddf=_0x2d161c;_0x5ecaeb[_0x022e('0x2b')]=_['keys'](db[_0x022e('0x48')][_0x022e('0x49')]);_0x5ecaeb[_0x022e('0x2c')]=_[_0x022e('0x2d')](_0x3a772f[_0x022e('0x2c')]);_0x5ecaeb['filters']=_['intersection'](_0x5ecaeb[_0x022e('0x2b')],_0x5ecaeb[_0x022e('0x2c')]);_0x568a39[_0x022e('0x30')]=_['intersection'](_0x5ecaeb[_0x022e('0x2b')],qs[_0x022e('0x3f')](_0x3a772f['query'][_0x022e('0x3f')]));_0x568a39[_0x022e('0x30')]=_0x568a39['attributes']['length']?_0x568a39[_0x022e('0x30')]:_0x5ecaeb[_0x022e('0x2b')];_0x568a39[_0x022e('0x32')]=qs[_0x022e('0x33')](_0x3a772f[_0x022e('0x2c')][_0x022e('0x33')]);_0x568a39[_0x022e('0x34')]=qs['filters'](_[_0x022e('0x4a')](_0x3a772f[_0x022e('0x2c')],_0x5ecaeb[_0x022e('0x2e')]));if(_0x3a772f[_0x022e('0x2c')][_0x022e('0x35')]){_0x568a39[_0x022e('0x34')]=_['merge'](_0x568a39[_0x022e('0x34')],{'$or':_[_0x022e('0x28')](_0x568a39[_0x022e('0x30')],function(_0x175c98){var _0x56367e={};_0x56367e[_0x175c98]={'$like':'%'+_0x3a772f[_0x022e('0x2c')][_0x022e('0x35')]+'%'};return _0x56367e;})});}_0x568a39=_['merge']({},_0x568a39,_0x3a772f[_0x022e('0x38')]);return _0x5e6ddf['getSubjects'](_0x568a39);}})['then'](function(_0x34402d){if(_0x34402d){_0x36604e=_0x34402d[_0x022e('0x40')];if(!_0x3a772f[_0x022e('0x2c')][_0x022e('0x4c')]('nolimit')){_0x568a39['limit']=qs[_0x022e('0x1d')](_0x3a772f[_0x022e('0x2c')][_0x022e('0x1d')]);_0x568a39['offset']=qs[_0x022e('0x1b')](_0x3a772f[_0x022e('0x2c')]['offset']);}return _0x5e6ddf[_0x022e('0x4d')](_0x568a39);}})[_0x022e('0x22')](function(_0x307756){if(_0x307756){return _0x307756?{'count':_0x36604e,'rows':_0x307756}:null;}})['then'](respondWithResult(_0x5923dc,null))[_0x022e('0x3c')](handleError(_0x5923dc,null));};exports[_0x022e('0x4e')]=function(_0xff8dc3,_0x38975a,_0x3032a5){var _0x3e9630={};var _0x575db7={};var _0x47f013;var _0xe9ab9d;return db[_0x022e('0x29')][_0x022e('0x47')]({'where':{'id':_0xff8dc3['params']['id']}})['then'](handleEntityNotFound(_0x38975a,null))[_0x022e('0x22')](function(_0x91f80a){if(_0x91f80a){_0x47f013=_0x91f80a;_0x575db7['model']=_[_0x022e('0x2d')](db[_0x022e('0x48')]['rawAttributes']);_0x575db7[_0x022e('0x2c')]=_[_0x022e('0x2d')](_0xff8dc3[_0x022e('0x2c')]);_0x575db7[_0x022e('0x2e')]=_[_0x022e('0x2f')](_0x575db7[_0x022e('0x2b')],_0x575db7[_0x022e('0x2c')]);_0x3e9630[_0x022e('0x30')]=_[_0x022e('0x2f')](_0x575db7['model'],qs['fields'](_0xff8dc3[_0x022e('0x2c')]['fields']));_0x3e9630['attributes']=_0x3e9630[_0x022e('0x30')][_0x022e('0x40')]?_0x3e9630['attributes']:_0x575db7['model'];_0x3e9630[_0x022e('0x32')]=qs[_0x022e('0x33')](_0xff8dc3['query'][_0x022e('0x33')]);_0x3e9630[_0x022e('0x34')]=qs[_0x022e('0x2e')](_[_0x022e('0x4a')](_0xff8dc3[_0x022e('0x2c')],_0x575db7['filters']));if(_0xff8dc3[_0x022e('0x2c')][_0x022e('0x35')]){_0x3e9630['where']=_[_0x022e('0x36')](_0x3e9630[_0x022e('0x34')],{'$or':_['map'](_0x3e9630[_0x022e('0x30')],function(_0x47c3a4){var _0x5b60fb={};_0x5b60fb[_0x47c3a4]={'$like':'%'+_0xff8dc3[_0x022e('0x2c')][_0x022e('0x35')]+'%'};return _0x5b60fb;})});}_0x3e9630=_[_0x022e('0x36')]({},_0x3e9630,_0xff8dc3[_0x022e('0x38')]);return _0x47f013[_0x022e('0x4e')](_0x3e9630);}})[_0x022e('0x22')](function(_0x1e2708){if(_0x1e2708){_0xe9ab9d=_0x1e2708[_0x022e('0x40')];if(!_0xff8dc3[_0x022e('0x2c')][_0x022e('0x4c')](_0x022e('0x31'))){_0x3e9630[_0x022e('0x1d')]=qs[_0x022e('0x1d')](_0xff8dc3[_0x022e('0x2c')][_0x022e('0x1d')]);_0x3e9630[_0x022e('0x1b')]=qs[_0x022e('0x1b')](_0xff8dc3[_0x022e('0x2c')][_0x022e('0x1b')]);}return _0x47f013[_0x022e('0x4e')](_0x3e9630);}})[_0x022e('0x22')](function(_0x889103){if(_0x889103){return _0x889103?{'count':_0xe9ab9d,'rows':_0x889103}:null;}})[_0x022e('0x22')](respondWithResult(_0x38975a,null))[_0x022e('0x3c')](handleError(_0x38975a,null));};
\ No newline at end of file
+var _0xa959=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','ZohoConfiguration','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','ZohoField','sort','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5a895e,_0x301dba){var _0x10b20e=function(_0x8b4737){while(--_0x8b4737){_0x5a895e['push'](_0x5a895e['shift']());}};_0x10b20e(++_0x301dba);}(_0xa959,0xe4));var _0x9a95=function(_0x481127,_0x166b93){_0x481127=_0x481127-0x0;var _0x282728=_0xa959[_0x481127];return _0x282728;};'use strict';var emlformat=require(_0x9a95('0x0'));var rimraf=require(_0x9a95('0x1'));var zipdir=require(_0x9a95('0x2'));var jsonpatch=require(_0x9a95('0x3'));var rp=require(_0x9a95('0x4'));var moment=require(_0x9a95('0x5'));var BPromise=require(_0x9a95('0x6'));var Mustache=require(_0x9a95('0x7'));var util=require(_0x9a95('0x8'));var path=require(_0x9a95('0x9'));var sox=require(_0x9a95('0xa'));var csv=require('to-csv');var ejs=require(_0x9a95('0xb'));var fs=require('fs');var fs_extra=require(_0x9a95('0xc'));var _=require(_0x9a95('0xd'));var squel=require(_0x9a95('0xe'));var crypto=require(_0x9a95('0xf'));var jsforce=require(_0x9a95('0x10'));var deskjs=require(_0x9a95('0x11'));var toCsv=require(_0x9a95('0x12'));var querystring=require('querystring');var Papa=require(_0x9a95('0x13'));var Redis=require('ioredis');var authService=require(_0x9a95('0x14'));var qs=require(_0x9a95('0x15'));var as=require(_0x9a95('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a95('0x17'))('api');var utils=require(_0x9a95('0x18'));var config=require(_0x9a95('0x19'));var licenseUtil=require(_0x9a95('0x1a'));var db=require(_0x9a95('0x1b'))['db'];function respondWithStatusCode(_0xd8bce9,_0x46dd3a){_0x46dd3a=_0x46dd3a||0xcc;return function(_0x1e0582){if(_0x1e0582){return _0xd8bce9[_0x9a95('0x1c')](_0x46dd3a);}return _0xd8bce9[_0x9a95('0x1d')](_0x46dd3a)[_0x9a95('0x1e')]();};}function respondWithResult(_0x5a47fa,_0x1ab950){_0x1ab950=_0x1ab950||0xc8;return function(_0x268e80){if(_0x268e80){return _0x5a47fa['status'](_0x1ab950)[_0x9a95('0x1f')](_0x268e80);}};}function respondWithFilteredResult(_0x30a70c,_0x334fd6){return function(_0x2c813a){if(_0x2c813a){var _0x5d2830=typeof _0x334fd6['offset']==='undefined'&&typeof _0x334fd6[_0x9a95('0x20')]===_0x9a95('0x21');var _0x101bc8=_0x2c813a[_0x9a95('0x22')];var _0xd80f6c=_0x5d2830?0x0:_0x334fd6[_0x9a95('0x23')];var _0x1cb0b0=_0x5d2830?_0x2c813a[_0x9a95('0x22')]:_0x334fd6[_0x9a95('0x23')]+_0x334fd6[_0x9a95('0x20')];var _0x326861;if(_0x1cb0b0>=_0x101bc8){_0x1cb0b0=_0x101bc8;_0x326861=0xc8;}else{_0x326861=0xce;}_0x30a70c['status'](_0x326861);return _0x30a70c[_0x9a95('0x24')](_0x9a95('0x25'),_0xd80f6c+'-'+_0x1cb0b0+'/'+_0x101bc8)[_0x9a95('0x1f')](_0x2c813a);}return null;};}function patchUpdates(_0x22ea01){return function(_0x39e444){try{jsonpatch[_0x9a95('0x26')](_0x39e444,_0x22ea01,!![]);}catch(_0x36267a){return BPromise[_0x9a95('0x27')](_0x36267a);}return _0x39e444['save']();};}function saveUpdates(_0x20d2c5,_0x1a459a){return function(_0x1b0570){if(_0x1b0570){return _0x1b0570[_0x9a95('0x28')](_0x20d2c5)[_0x9a95('0x29')](function(_0x18372c){return _0x18372c;});}return null;};}function removeEntity(_0x3e3274,_0x1dd017){return function(_0x617eb8){if(_0x617eb8){return _0x617eb8[_0x9a95('0x2a')]()['then'](function(){_0x3e3274[_0x9a95('0x1d')](0xcc)[_0x9a95('0x1e')]();});}};}function handleEntityNotFound(_0x3becdb,_0x36f3ba){return function(_0x2e123f){if(!_0x2e123f){_0x3becdb[_0x9a95('0x1c')](0x194);}return _0x2e123f;};}function handleError(_0xc19d8b,_0x3875eb){_0x3875eb=_0x3875eb||0x1f4;return function(_0x4d31a6){logger[_0x9a95('0x2b')](_0x4d31a6[_0x9a95('0x2c')]);if(_0x4d31a6[_0x9a95('0x2d')]){delete _0x4d31a6['name'];}_0xc19d8b['status'](_0x3875eb)['send'](_0x4d31a6);};}exports[_0x9a95('0x2e')]=function(_0x29c44d,_0x3ee27f){var _0x1d28d1={},_0x206d3f={},_0x5ef7f1={'count':0x0,'rows':[]};var _0x21fcac=_['map'](db['ZohoConfiguration'][_0x9a95('0x2f')],function(_0x3b142b){return{'name':_0x3b142b['fieldName'],'type':_0x3b142b['type'][_0x9a95('0x30')]};});_0x206d3f[_0x9a95('0x31')]=_[_0x9a95('0x32')](_0x21fcac,_0x9a95('0x2d'));_0x206d3f[_0x9a95('0x33')]=_[_0x9a95('0x34')](_0x29c44d['query']);_0x206d3f[_0x9a95('0x35')]=_[_0x9a95('0x36')](_0x206d3f[_0x9a95('0x31')],_0x206d3f[_0x9a95('0x33')]);_0x1d28d1[_0x9a95('0x37')]=_[_0x9a95('0x36')](_0x206d3f[_0x9a95('0x31')],qs[_0x9a95('0x38')](_0x29c44d['query'][_0x9a95('0x38')]));_0x1d28d1[_0x9a95('0x37')]=_0x1d28d1[_0x9a95('0x37')][_0x9a95('0x39')]?_0x1d28d1[_0x9a95('0x37')]:_0x206d3f[_0x9a95('0x31')];if(!_0x29c44d[_0x9a95('0x33')][_0x9a95('0x3a')](_0x9a95('0x3b'))){_0x1d28d1['limit']=qs[_0x9a95('0x20')](_0x29c44d['query']['limit']);_0x1d28d1[_0x9a95('0x23')]=qs[_0x9a95('0x23')](_0x29c44d[_0x9a95('0x33')][_0x9a95('0x23')]);}_0x1d28d1[_0x9a95('0x3c')]=qs['sort'](_0x29c44d[_0x9a95('0x33')]['sort']);_0x1d28d1[_0x9a95('0x3d')]=qs['filters'](_[_0x9a95('0x3e')](_0x29c44d[_0x9a95('0x33')],_0x206d3f[_0x9a95('0x35')]),_0x21fcac);if(_0x29c44d[_0x9a95('0x33')][_0x9a95('0x3f')]){_0x1d28d1['where']=_['merge'](_0x1d28d1[_0x9a95('0x3d')],{'$or':_['map'](_0x21fcac,function(_0x4c04e5){if(_0x4c04e5[_0x9a95('0x40')]!==_0x9a95('0x41')){var _0x49247c={};_0x49247c[_0x4c04e5['name']]={'$like':'%'+_0x29c44d[_0x9a95('0x33')]['filter']+'%'};return _0x49247c;}})});}_0x1d28d1=_[_0x9a95('0x42')]({},_0x1d28d1,_0x29c44d['options']);var _0x4bb888={'where':_0x1d28d1['where']};return db[_0x9a95('0x43')][_0x9a95('0x22')](_0x4bb888)[_0x9a95('0x29')](function(_0x5976c1){_0x5ef7f1[_0x9a95('0x22')]=_0x5976c1;if(_0x29c44d[_0x9a95('0x33')][_0x9a95('0x44')]){_0x1d28d1[_0x9a95('0x45')]=[{'all':!![]}];}return db[_0x9a95('0x43')][_0x9a95('0x46')](_0x1d28d1);})[_0x9a95('0x29')](function(_0x23d215){_0x5ef7f1[_0x9a95('0x47')]=_0x23d215;return _0x5ef7f1;})[_0x9a95('0x29')](respondWithFilteredResult(_0x3ee27f,_0x1d28d1))[_0x9a95('0x48')](handleError(_0x3ee27f,null));};exports[_0x9a95('0x49')]=function(_0x22511c,_0x5918d3){var _0x56ade4={'raw':![],'where':{'id':_0x22511c[_0x9a95('0x4a')]['id']}},_0x54e624={};_0x54e624['model']=_[_0x9a95('0x34')](db[_0x9a95('0x43')][_0x9a95('0x2f')]);_0x54e624[_0x9a95('0x33')]=_[_0x9a95('0x34')](_0x22511c[_0x9a95('0x33')]);_0x54e624[_0x9a95('0x35')]=_[_0x9a95('0x36')](_0x54e624[_0x9a95('0x31')],_0x54e624['query']);_0x56ade4[_0x9a95('0x37')]=_[_0x9a95('0x36')](_0x54e624[_0x9a95('0x31')],qs['fields'](_0x22511c[_0x9a95('0x33')][_0x9a95('0x38')]));_0x56ade4['attributes']=_0x56ade4[_0x9a95('0x37')][_0x9a95('0x39')]?_0x56ade4[_0x9a95('0x37')]:_0x54e624[_0x9a95('0x31')];if(_0x22511c['query'][_0x9a95('0x44')]){_0x56ade4['include']=[{'all':!![]}];}_0x56ade4=_[_0x9a95('0x42')]({},_0x56ade4,_0x22511c[_0x9a95('0x4b')]);return db[_0x9a95('0x43')][_0x9a95('0x4c')](_0x56ade4)[_0x9a95('0x29')](handleEntityNotFound(_0x5918d3,null))['then'](respondWithResult(_0x5918d3,null))[_0x9a95('0x48')](handleError(_0x5918d3,null));};exports[_0x9a95('0x4d')]=function(_0x4bc06b,_0x1bf928){return db['ZohoConfiguration'][_0x9a95('0x4d')](_0x4bc06b[_0x9a95('0x4e')],{})['then'](respondWithResult(_0x1bf928,0xc9))['catch'](handleError(_0x1bf928,null));};exports[_0x9a95('0x28')]=function(_0x29bed5,_0x4c1116){if(_0x29bed5['body']['id']){delete _0x29bed5['body']['id'];}return db[_0x9a95('0x43')][_0x9a95('0x4c')]({'where':{'id':_0x29bed5[_0x9a95('0x4a')]['id']}})[_0x9a95('0x29')](handleEntityNotFound(_0x4c1116,null))[_0x9a95('0x29')](saveUpdates(_0x29bed5[_0x9a95('0x4e')],null))[_0x9a95('0x29')](respondWithResult(_0x4c1116,null))['catch'](handleError(_0x4c1116,null));};exports[_0x9a95('0x2a')]=function(_0x568dbe,_0x5d800e){return db[_0x9a95('0x43')][_0x9a95('0x4c')]({'where':{'id':_0x568dbe[_0x9a95('0x4a')]['id']}})[_0x9a95('0x29')](handleEntityNotFound(_0x5d800e,null))[_0x9a95('0x29')](removeEntity(_0x5d800e,null))[_0x9a95('0x48')](handleError(_0x5d800e,null));};exports[_0x9a95('0x4f')]=function(_0x59064e,_0x320c99,_0x1e05e5){var _0x486eef={};var _0x519f32={};var _0xa98dcb;var _0x3b012b;return db[_0x9a95('0x43')]['findOne']({'where':{'id':_0x59064e[_0x9a95('0x4a')]['id']}})[_0x9a95('0x29')](handleEntityNotFound(_0x320c99,null))[_0x9a95('0x29')](function(_0x1b5939){if(_0x1b5939){_0xa98dcb=_0x1b5939;_0x519f32[_0x9a95('0x31')]=_[_0x9a95('0x34')](db[_0x9a95('0x50')]['rawAttributes']);_0x519f32[_0x9a95('0x33')]=_[_0x9a95('0x34')](_0x59064e[_0x9a95('0x33')]);_0x519f32['filters']=_[_0x9a95('0x36')](_0x519f32[_0x9a95('0x31')],_0x519f32[_0x9a95('0x33')]);_0x486eef[_0x9a95('0x37')]=_[_0x9a95('0x36')](_0x519f32[_0x9a95('0x31')],qs[_0x9a95('0x38')](_0x59064e[_0x9a95('0x33')][_0x9a95('0x38')]));_0x486eef['attributes']=_0x486eef['attributes'][_0x9a95('0x39')]?_0x486eef[_0x9a95('0x37')]:_0x519f32[_0x9a95('0x31')];_0x486eef['order']=qs['sort'](_0x59064e[_0x9a95('0x33')][_0x9a95('0x51')]);_0x486eef['where']=qs[_0x9a95('0x35')](_[_0x9a95('0x3e')](_0x59064e['query'],_0x519f32[_0x9a95('0x35')]));if(_0x59064e[_0x9a95('0x33')]['filter']){_0x486eef[_0x9a95('0x3d')]=_[_0x9a95('0x42')](_0x486eef[_0x9a95('0x3d')],{'$or':_[_0x9a95('0x32')](_0x486eef[_0x9a95('0x37')],function(_0x3f2e8b){var _0x18fbfd={};_0x18fbfd[_0x3f2e8b]={'$like':'%'+_0x59064e[_0x9a95('0x33')]['filter']+'%'};return _0x18fbfd;})});}_0x486eef=_[_0x9a95('0x42')]({},_0x486eef,_0x59064e['options']);return _0xa98dcb[_0x9a95('0x4f')](_0x486eef);}})[_0x9a95('0x29')](function(_0x33a31f){if(_0x33a31f){_0x3b012b=_0x33a31f[_0x9a95('0x39')];if(!_0x59064e['query'][_0x9a95('0x3a')](_0x9a95('0x3b'))){_0x486eef['limit']=qs[_0x9a95('0x20')](_0x59064e[_0x9a95('0x33')][_0x9a95('0x20')]);_0x486eef['offset']=qs[_0x9a95('0x23')](_0x59064e['query'][_0x9a95('0x23')]);}return _0xa98dcb[_0x9a95('0x4f')](_0x486eef);}})[_0x9a95('0x29')](function(_0x1eea4a){if(_0x1eea4a){return _0x1eea4a?{'count':_0x3b012b,'rows':_0x1eea4a}:null;}})[_0x9a95('0x29')](respondWithResult(_0x320c99,null))[_0x9a95('0x48')](handleError(_0x320c99,null));};exports[_0x9a95('0x52')]=function(_0x156994,_0x57eccb,_0x24fbe2){var _0x4e7831={};var _0x2d705e={};var _0x3ffa96;var _0x28e3f5;return db[_0x9a95('0x43')][_0x9a95('0x53')]({'where':{'id':_0x156994[_0x9a95('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57eccb,null))[_0x9a95('0x29')](function(_0x1d16db){if(_0x1d16db){_0x3ffa96=_0x1d16db;_0x2d705e[_0x9a95('0x31')]=_[_0x9a95('0x34')](db[_0x9a95('0x50')][_0x9a95('0x2f')]);_0x2d705e[_0x9a95('0x33')]=_[_0x9a95('0x34')](_0x156994[_0x9a95('0x33')]);_0x2d705e[_0x9a95('0x35')]=_[_0x9a95('0x36')](_0x2d705e[_0x9a95('0x31')],_0x2d705e[_0x9a95('0x33')]);_0x4e7831['attributes']=_[_0x9a95('0x36')](_0x2d705e[_0x9a95('0x31')],qs['fields'](_0x156994['query'][_0x9a95('0x38')]));_0x4e7831[_0x9a95('0x37')]=_0x4e7831[_0x9a95('0x37')][_0x9a95('0x39')]?_0x4e7831['attributes']:_0x2d705e[_0x9a95('0x31')];_0x4e7831[_0x9a95('0x3c')]=qs[_0x9a95('0x51')](_0x156994[_0x9a95('0x33')][_0x9a95('0x51')]);_0x4e7831['where']=qs[_0x9a95('0x35')](_[_0x9a95('0x3e')](_0x156994[_0x9a95('0x33')],_0x2d705e[_0x9a95('0x35')]));if(_0x156994[_0x9a95('0x33')][_0x9a95('0x3f')]){_0x4e7831[_0x9a95('0x3d')]=_[_0x9a95('0x42')](_0x4e7831[_0x9a95('0x3d')],{'$or':_[_0x9a95('0x32')](_0x4e7831[_0x9a95('0x37')],function(_0x196c56){var _0x3e936b={};_0x3e936b[_0x196c56]={'$like':'%'+_0x156994[_0x9a95('0x33')][_0x9a95('0x3f')]+'%'};return _0x3e936b;})});}_0x4e7831=_[_0x9a95('0x42')]({},_0x4e7831,_0x156994[_0x9a95('0x4b')]);return _0x3ffa96['getSubjects'](_0x4e7831);}})['then'](function(_0x19de4c){if(_0x19de4c){_0x28e3f5=_0x19de4c[_0x9a95('0x39')];if(!_0x156994[_0x9a95('0x33')][_0x9a95('0x3a')](_0x9a95('0x3b'))){_0x4e7831[_0x9a95('0x20')]=qs['limit'](_0x156994[_0x9a95('0x33')][_0x9a95('0x20')]);_0x4e7831[_0x9a95('0x23')]=qs[_0x9a95('0x23')](_0x156994['query'][_0x9a95('0x23')]);}return _0x3ffa96['getSubjects'](_0x4e7831);}})[_0x9a95('0x29')](function(_0x20edc0){if(_0x20edc0){return _0x20edc0?{'count':_0x28e3f5,'rows':_0x20edc0}:null;}})['then'](respondWithResult(_0x57eccb,null))[_0x9a95('0x48')](handleError(_0x57eccb,null));};exports[_0x9a95('0x54')]=function(_0xd09b94,_0x5ec143,_0x4c448c){var _0xc5a0d2={};var _0x16ef3e={};var _0x100cf2;var _0x5dd263;return db[_0x9a95('0x43')][_0x9a95('0x53')]({'where':{'id':_0xd09b94[_0x9a95('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ec143,null))[_0x9a95('0x29')](function(_0x321235){if(_0x321235){_0x100cf2=_0x321235;_0x16ef3e[_0x9a95('0x31')]=_[_0x9a95('0x34')](db['ZohoField']['rawAttributes']);_0x16ef3e[_0x9a95('0x33')]=_['keys'](_0xd09b94['query']);_0x16ef3e[_0x9a95('0x35')]=_[_0x9a95('0x36')](_0x16ef3e[_0x9a95('0x31')],_0x16ef3e[_0x9a95('0x33')]);_0xc5a0d2[_0x9a95('0x37')]=_[_0x9a95('0x36')](_0x16ef3e[_0x9a95('0x31')],qs['fields'](_0xd09b94['query'][_0x9a95('0x38')]));_0xc5a0d2['attributes']=_0xc5a0d2[_0x9a95('0x37')][_0x9a95('0x39')]?_0xc5a0d2['attributes']:_0x16ef3e['model'];_0xc5a0d2[_0x9a95('0x3c')]=qs[_0x9a95('0x51')](_0xd09b94[_0x9a95('0x33')][_0x9a95('0x51')]);_0xc5a0d2[_0x9a95('0x3d')]=qs[_0x9a95('0x35')](_[_0x9a95('0x3e')](_0xd09b94['query'],_0x16ef3e[_0x9a95('0x35')]));if(_0xd09b94[_0x9a95('0x33')][_0x9a95('0x3f')]){_0xc5a0d2[_0x9a95('0x3d')]=_[_0x9a95('0x42')](_0xc5a0d2[_0x9a95('0x3d')],{'$or':_[_0x9a95('0x32')](_0xc5a0d2[_0x9a95('0x37')],function(_0x5c1621){var _0x59a330={};_0x59a330[_0x5c1621]={'$like':'%'+_0xd09b94[_0x9a95('0x33')][_0x9a95('0x3f')]+'%'};return _0x59a330;})});}_0xc5a0d2=_[_0x9a95('0x42')]({},_0xc5a0d2,_0xd09b94[_0x9a95('0x4b')]);return _0x100cf2[_0x9a95('0x54')](_0xc5a0d2);}})[_0x9a95('0x29')](function(_0x2e84ad){if(_0x2e84ad){_0x5dd263=_0x2e84ad[_0x9a95('0x39')];if(!_0xd09b94['query'][_0x9a95('0x3a')](_0x9a95('0x3b'))){_0xc5a0d2[_0x9a95('0x20')]=qs[_0x9a95('0x20')](_0xd09b94[_0x9a95('0x33')][_0x9a95('0x20')]);_0xc5a0d2[_0x9a95('0x23')]=qs['offset'](_0xd09b94[_0x9a95('0x33')][_0x9a95('0x23')]);}return _0x100cf2[_0x9a95('0x54')](_0xc5a0d2);}})[_0x9a95('0x29')](function(_0x5b6c9c){if(_0x5b6c9c){return _0x5b6c9c?{'count':_0x5dd263,'rows':_0x5b6c9c}:null;}})['then'](respondWithResult(_0x5ec143,null))['catch'](handleError(_0x5ec143,null));};
\ No newline at end of file