Built motion from commit e6806ed6.|2.6.0
[motion2.git] / server / api / intZohoConfiguration / intZohoConfiguration.controller.js
index 5e3e42a..da6c27e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x77c0=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','show','params','keys','length','create','body','catch','find','getFields','ZohoField','order','findOne','getSubjects','nolimit','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x77c0,0xd6));var _0x077c=function(_0x503f99,_0x515639){_0x503f99=_0x503f99-0x0;var _0x19ffd3=_0x77c0[_0x503f99];return _0x19ffd3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x077c('0x0'));var jsonpatch=require(_0x077c('0x1'));var rp=require(_0x077c('0x2'));var moment=require(_0x077c('0x3'));var BPromise=require(_0x077c('0x4'));var Mustache=require(_0x077c('0x5'));var util=require(_0x077c('0x6'));var path=require(_0x077c('0x7'));var sox=require(_0x077c('0x8'));var csv=require(_0x077c('0x9'));var ejs=require(_0x077c('0xa'));var fs=require('fs');var fs_extra=require(_0x077c('0xb'));var _=require(_0x077c('0xc'));var squel=require(_0x077c('0xd'));var crypto=require(_0x077c('0xe'));var jsforce=require(_0x077c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x077c('0x9'));var querystring=require(_0x077c('0x10'));var Papa=require(_0x077c('0x11'));var Redis=require(_0x077c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x077c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x077c('0x14'));var logger=require(_0x077c('0x15'))(_0x077c('0x16'));var utils=require(_0x077c('0x17'));var config=require(_0x077c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x077c('0x19'))['db'];function respondWithStatusCode(_0x57f00a,_0xab0fd){_0xab0fd=_0xab0fd||0xcc;return function(_0x83bcd8){if(_0x83bcd8){return _0x57f00a[_0x077c('0x1a')](_0xab0fd);}return _0x57f00a[_0x077c('0x1b')](_0xab0fd)[_0x077c('0x1c')]();};}function respondWithResult(_0x11f81e,_0x502a03){_0x502a03=_0x502a03||0xc8;return function(_0x45b51c){if(_0x45b51c){return _0x11f81e['status'](_0x502a03)[_0x077c('0x1d')](_0x45b51c);}};}function respondWithFilteredResult(_0x28da58,_0x314ad0){return function(_0xc7c2b1){if(_0xc7c2b1){var _0x419668=typeof _0x314ad0[_0x077c('0x1e')]===_0x077c('0x1f')&&typeof _0x314ad0[_0x077c('0x20')]===_0x077c('0x1f');var _0x3dd651=_0xc7c2b1['count'];var _0x3553d2=_0x419668?0x0:_0x314ad0[_0x077c('0x1e')];var _0x58a607=_0x419668?_0xc7c2b1[_0x077c('0x21')]:_0x314ad0['offset']+_0x314ad0['limit'];var _0xd5e5dc;if(_0x58a607>=_0x3dd651){_0x58a607=_0x3dd651;_0xd5e5dc=0xc8;}else{_0xd5e5dc=0xce;}_0x28da58[_0x077c('0x1b')](_0xd5e5dc);return _0x28da58['set'](_0x077c('0x22'),_0x3553d2+'-'+_0x58a607+'/'+_0x3dd651)[_0x077c('0x1d')](_0xc7c2b1);}return null;};}function patchUpdates(_0x4eda98){return function(_0x5cd834){try{jsonpatch[_0x077c('0x23')](_0x5cd834,_0x4eda98,!![]);}catch(_0x8d0636){return BPromise[_0x077c('0x24')](_0x8d0636);}return _0x5cd834['save']();};}function saveUpdates(_0x445d70,_0x2262c4){return function(_0x52ac39){if(_0x52ac39){return _0x52ac39[_0x077c('0x25')](_0x445d70)[_0x077c('0x26')](function(_0xbb2f6){return _0xbb2f6;});}return null;};}function removeEntity(_0x31288c,_0x301f1a){return function(_0x433140){if(_0x433140){return _0x433140[_0x077c('0x27')]()[_0x077c('0x26')](function(){_0x31288c[_0x077c('0x1b')](0xcc)[_0x077c('0x1c')]();});}};}function handleEntityNotFound(_0x32ed07,_0x18e7f9){return function(_0xbb7cec){if(!_0xbb7cec){_0x32ed07[_0x077c('0x1a')](0x194);}return _0xbb7cec;};}function handleError(_0x20b410,_0x38ca3a){_0x38ca3a=_0x38ca3a||0x1f4;return function(_0x3b9939){logger[_0x077c('0x28')](_0x3b9939[_0x077c('0x29')]);if(_0x3b9939[_0x077c('0x2a')]){delete _0x3b9939[_0x077c('0x2a')];}_0x20b410[_0x077c('0x1b')](_0x38ca3a)['send'](_0x3b9939);};}exports['index']=function(_0x279f7f,_0x53b0fd){var _0x5979f8={},_0x3fd8c1={},_0x23236c={'count':0x0,'rows':[]};var _0x42be71=_['map'](db[_0x077c('0x2b')][_0x077c('0x2c')],function(_0x573eec){return{'name':_0x573eec[_0x077c('0x2d')],'type':_0x573eec[_0x077c('0x2e')][_0x077c('0x2f')]};});_0x3fd8c1[_0x077c('0x30')]=_['map'](_0x42be71,_0x077c('0x2a'));_0x3fd8c1[_0x077c('0x31')]=_['keys'](_0x279f7f[_0x077c('0x31')]);_0x3fd8c1[_0x077c('0x32')]=_[_0x077c('0x33')](_0x3fd8c1[_0x077c('0x30')],_0x3fd8c1[_0x077c('0x31')]);_0x5979f8[_0x077c('0x34')]=_[_0x077c('0x33')](_0x3fd8c1['model'],qs[_0x077c('0x35')](_0x279f7f['query'][_0x077c('0x35')]));_0x5979f8[_0x077c('0x34')]=_0x5979f8[_0x077c('0x34')]['length']?_0x5979f8[_0x077c('0x34')]:_0x3fd8c1[_0x077c('0x30')];if(!_0x279f7f[_0x077c('0x31')][_0x077c('0x36')]('nolimit')){_0x5979f8[_0x077c('0x20')]=qs[_0x077c('0x20')](_0x279f7f[_0x077c('0x31')][_0x077c('0x20')]);_0x5979f8['offset']=qs[_0x077c('0x1e')](_0x279f7f[_0x077c('0x31')][_0x077c('0x1e')]);}_0x5979f8['order']=qs['sort'](_0x279f7f[_0x077c('0x31')][_0x077c('0x37')]);_0x5979f8[_0x077c('0x38')]=qs['filters'](_[_0x077c('0x39')](_0x279f7f[_0x077c('0x31')],_0x3fd8c1['filters']),_0x42be71);if(_0x279f7f[_0x077c('0x31')][_0x077c('0x3a')]){_0x5979f8[_0x077c('0x38')]=_[_0x077c('0x3b')](_0x5979f8[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x42be71,function(_0x4f4807){if(_0x4f4807[_0x077c('0x2e')]!=='VIRTUAL'){var _0x5dcd83={};_0x5dcd83[_0x4f4807[_0x077c('0x2a')]]={'$like':'%'+_0x279f7f['query']['filter']+'%'};return _0x5dcd83;}})});}_0x5979f8=_[_0x077c('0x3b')]({},_0x5979f8,_0x279f7f[_0x077c('0x3d')]);var _0x172c64={'where':_0x5979f8[_0x077c('0x38')]};return db[_0x077c('0x2b')][_0x077c('0x21')](_0x172c64)['then'](function(_0x464797){_0x23236c[_0x077c('0x21')]=_0x464797;if(_0x279f7f[_0x077c('0x31')][_0x077c('0x3e')]){_0x5979f8[_0x077c('0x3f')]=[{'all':!![]}];}return db[_0x077c('0x2b')][_0x077c('0x40')](_0x5979f8);})[_0x077c('0x26')](function(_0xc5f33a){_0x23236c['rows']=_0xc5f33a;return _0x23236c;})[_0x077c('0x26')](respondWithFilteredResult(_0x53b0fd,_0x5979f8))['catch'](handleError(_0x53b0fd,null));};exports[_0x077c('0x41')]=function(_0x13eb83,_0x24d5ee){var _0x4d7a8e={'raw':![],'where':{'id':_0x13eb83[_0x077c('0x42')]['id']}},_0x67fe92={};_0x67fe92[_0x077c('0x30')]=_['keys'](db[_0x077c('0x2b')][_0x077c('0x2c')]);_0x67fe92['query']=_[_0x077c('0x43')](_0x13eb83[_0x077c('0x31')]);_0x67fe92[_0x077c('0x32')]=_['intersection'](_0x67fe92[_0x077c('0x30')],_0x67fe92[_0x077c('0x31')]);_0x4d7a8e[_0x077c('0x34')]=_[_0x077c('0x33')](_0x67fe92[_0x077c('0x30')],qs[_0x077c('0x35')](_0x13eb83['query']['fields']));_0x4d7a8e[_0x077c('0x34')]=_0x4d7a8e[_0x077c('0x34')][_0x077c('0x44')]?_0x4d7a8e[_0x077c('0x34')]:_0x67fe92[_0x077c('0x30')];if(_0x13eb83[_0x077c('0x31')][_0x077c('0x3e')]){_0x4d7a8e[_0x077c('0x3f')]=[{'all':!![]}];}_0x4d7a8e=_[_0x077c('0x3b')]({},_0x4d7a8e,_0x13eb83[_0x077c('0x3d')]);return db[_0x077c('0x2b')]['find'](_0x4d7a8e)['then'](handleEntityNotFound(_0x24d5ee,null))[_0x077c('0x26')](respondWithResult(_0x24d5ee,null))['catch'](handleError(_0x24d5ee,null));};exports[_0x077c('0x45')]=function(_0x4750dc,_0xb75ec){return db[_0x077c('0x2b')][_0x077c('0x45')](_0x4750dc[_0x077c('0x46')],{})[_0x077c('0x26')](respondWithResult(_0xb75ec,0xc9))[_0x077c('0x47')](handleError(_0xb75ec,null));};exports['update']=function(_0x4e474e,_0x277f59){if(_0x4e474e[_0x077c('0x46')]['id']){delete _0x4e474e['body']['id'];}return db[_0x077c('0x2b')][_0x077c('0x48')]({'where':{'id':_0x4e474e['params']['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x277f59,null))[_0x077c('0x26')](saveUpdates(_0x4e474e[_0x077c('0x46')],null))['then'](respondWithResult(_0x277f59,null))[_0x077c('0x47')](handleError(_0x277f59,null));};exports['destroy']=function(_0x56f4fc,_0x2a207e){return db[_0x077c('0x2b')]['find']({'where':{'id':_0x56f4fc[_0x077c('0x42')]['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x2a207e,null))[_0x077c('0x26')](removeEntity(_0x2a207e,null))['catch'](handleError(_0x2a207e,null));};exports[_0x077c('0x49')]=function(_0x4d953c,_0x85c61,_0x51b8b7){var _0x88abad={};var _0x2424be={};var _0x39a830;var _0x11fd8a;return db[_0x077c('0x2b')]['findOne']({'where':{'id':_0x4d953c[_0x077c('0x42')]['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x85c61,null))[_0x077c('0x26')](function(_0x2dd5fa){if(_0x2dd5fa){_0x39a830=_0x2dd5fa;_0x2424be['model']=_[_0x077c('0x43')](db[_0x077c('0x4a')]['rawAttributes']);_0x2424be[_0x077c('0x31')]=_[_0x077c('0x43')](_0x4d953c[_0x077c('0x31')]);_0x2424be[_0x077c('0x32')]=_['intersection'](_0x2424be['model'],_0x2424be['query']);_0x88abad[_0x077c('0x34')]=_[_0x077c('0x33')](_0x2424be['model'],qs[_0x077c('0x35')](_0x4d953c['query']['fields']));_0x88abad[_0x077c('0x34')]=_0x88abad[_0x077c('0x34')][_0x077c('0x44')]?_0x88abad['attributes']:_0x2424be[_0x077c('0x30')];_0x88abad[_0x077c('0x4b')]=qs['sort'](_0x4d953c[_0x077c('0x31')][_0x077c('0x37')]);_0x88abad[_0x077c('0x38')]=qs['filters'](_['pick'](_0x4d953c[_0x077c('0x31')],_0x2424be[_0x077c('0x32')]));if(_0x4d953c[_0x077c('0x31')][_0x077c('0x3a')]){_0x88abad[_0x077c('0x38')]=_[_0x077c('0x3b')](_0x88abad[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x88abad[_0x077c('0x34')],function(_0x4be201){var _0x6c33cf={};_0x6c33cf[_0x4be201]={'$like':'%'+_0x4d953c[_0x077c('0x31')][_0x077c('0x3a')]+'%'};return _0x6c33cf;})});}_0x88abad=_[_0x077c('0x3b')]({},_0x88abad,_0x4d953c['options']);return _0x39a830[_0x077c('0x49')](_0x88abad);}})[_0x077c('0x26')](function(_0x4bab82){if(_0x4bab82){_0x11fd8a=_0x4bab82[_0x077c('0x44')];if(!_0x4d953c['query'][_0x077c('0x36')]('nolimit')){_0x88abad[_0x077c('0x20')]=qs[_0x077c('0x20')](_0x4d953c[_0x077c('0x31')][_0x077c('0x20')]);_0x88abad['offset']=qs[_0x077c('0x1e')](_0x4d953c['query'][_0x077c('0x1e')]);}return _0x39a830[_0x077c('0x49')](_0x88abad);}})[_0x077c('0x26')](function(_0x55a8e0){if(_0x55a8e0){return _0x55a8e0?{'count':_0x11fd8a,'rows':_0x55a8e0}:null;}})[_0x077c('0x26')](respondWithResult(_0x85c61,null))[_0x077c('0x47')](handleError(_0x85c61,null));};exports['getSubjects']=function(_0x276d9f,_0x49c72e,_0x5c2ccf){var _0x178e0f={};var _0x36b1cb={};var _0x30f24e;var _0xcc3d86;return db[_0x077c('0x2b')][_0x077c('0x4c')]({'where':{'id':_0x276d9f['params']['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x49c72e,null))[_0x077c('0x26')](function(_0x7e821a){if(_0x7e821a){_0x30f24e=_0x7e821a;_0x36b1cb[_0x077c('0x30')]=_['keys'](db['ZohoField'][_0x077c('0x2c')]);_0x36b1cb[_0x077c('0x31')]=_[_0x077c('0x43')](_0x276d9f[_0x077c('0x31')]);_0x36b1cb[_0x077c('0x32')]=_[_0x077c('0x33')](_0x36b1cb[_0x077c('0x30')],_0x36b1cb[_0x077c('0x31')]);_0x178e0f[_0x077c('0x34')]=_[_0x077c('0x33')](_0x36b1cb[_0x077c('0x30')],qs[_0x077c('0x35')](_0x276d9f[_0x077c('0x31')][_0x077c('0x35')]));_0x178e0f['attributes']=_0x178e0f[_0x077c('0x34')][_0x077c('0x44')]?_0x178e0f[_0x077c('0x34')]:_0x36b1cb[_0x077c('0x30')];_0x178e0f[_0x077c('0x4b')]=qs[_0x077c('0x37')](_0x276d9f[_0x077c('0x31')][_0x077c('0x37')]);_0x178e0f['where']=qs[_0x077c('0x32')](_[_0x077c('0x39')](_0x276d9f[_0x077c('0x31')],_0x36b1cb['filters']));if(_0x276d9f[_0x077c('0x31')][_0x077c('0x3a')]){_0x178e0f['where']=_[_0x077c('0x3b')](_0x178e0f[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x178e0f[_0x077c('0x34')],function(_0x30401d){var _0x52191a={};_0x52191a[_0x30401d]={'$like':'%'+_0x276d9f['query'][_0x077c('0x3a')]+'%'};return _0x52191a;})});}_0x178e0f=_[_0x077c('0x3b')]({},_0x178e0f,_0x276d9f[_0x077c('0x3d')]);return _0x30f24e[_0x077c('0x4d')](_0x178e0f);}})[_0x077c('0x26')](function(_0x2cf126){if(_0x2cf126){_0xcc3d86=_0x2cf126[_0x077c('0x44')];if(!_0x276d9f[_0x077c('0x31')][_0x077c('0x36')](_0x077c('0x4e'))){_0x178e0f['limit']=qs['limit'](_0x276d9f[_0x077c('0x31')][_0x077c('0x20')]);_0x178e0f[_0x077c('0x1e')]=qs[_0x077c('0x1e')](_0x276d9f['query'][_0x077c('0x1e')]);}return _0x30f24e[_0x077c('0x4d')](_0x178e0f);}})['then'](function(_0x1e20b9){if(_0x1e20b9){return _0x1e20b9?{'count':_0xcc3d86,'rows':_0x1e20b9}:null;}})[_0x077c('0x26')](respondWithResult(_0x49c72e,null))[_0x077c('0x47')](handleError(_0x49c72e,null));};exports['getDescriptions']=function(_0x50fb41,_0x4beab1,_0x4a02ae){var _0x477d97={};var _0x40d0f6={};var _0x3a1bbd;var _0x42b9de;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x50fb41[_0x077c('0x42')]['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x4beab1,null))[_0x077c('0x26')](function(_0xc8b30a){if(_0xc8b30a){_0x3a1bbd=_0xc8b30a;_0x40d0f6[_0x077c('0x30')]=_['keys'](db['ZohoField']['rawAttributes']);_0x40d0f6[_0x077c('0x31')]=_[_0x077c('0x43')](_0x50fb41['query']);_0x40d0f6[_0x077c('0x32')]=_[_0x077c('0x33')](_0x40d0f6[_0x077c('0x30')],_0x40d0f6[_0x077c('0x31')]);_0x477d97[_0x077c('0x34')]=_[_0x077c('0x33')](_0x40d0f6[_0x077c('0x30')],qs[_0x077c('0x35')](_0x50fb41['query']['fields']));_0x477d97[_0x077c('0x34')]=_0x477d97['attributes'][_0x077c('0x44')]?_0x477d97['attributes']:_0x40d0f6[_0x077c('0x30')];_0x477d97[_0x077c('0x4b')]=qs[_0x077c('0x37')](_0x50fb41[_0x077c('0x31')][_0x077c('0x37')]);_0x477d97[_0x077c('0x38')]=qs[_0x077c('0x32')](_[_0x077c('0x39')](_0x50fb41[_0x077c('0x31')],_0x40d0f6[_0x077c('0x32')]));if(_0x50fb41['query'][_0x077c('0x3a')]){_0x477d97[_0x077c('0x38')]=_[_0x077c('0x3b')](_0x477d97[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x477d97['attributes'],function(_0xd57c90){var _0x19e45a={};_0x19e45a[_0xd57c90]={'$like':'%'+_0x50fb41[_0x077c('0x31')]['filter']+'%'};return _0x19e45a;})});}_0x477d97=_[_0x077c('0x3b')]({},_0x477d97,_0x50fb41[_0x077c('0x3d')]);return _0x3a1bbd[_0x077c('0x4f')](_0x477d97);}})[_0x077c('0x26')](function(_0xf3880c){if(_0xf3880c){_0x42b9de=_0xf3880c[_0x077c('0x44')];if(!_0x50fb41[_0x077c('0x31')][_0x077c('0x36')](_0x077c('0x4e'))){_0x477d97[_0x077c('0x20')]=qs['limit'](_0x50fb41[_0x077c('0x31')][_0x077c('0x20')]);_0x477d97['offset']=qs['offset'](_0x50fb41[_0x077c('0x31')]['offset']);}return _0x3a1bbd[_0x077c('0x4f')](_0x477d97);}})[_0x077c('0x26')](function(_0x5c699c){if(_0x5c699c){return _0x5c699c?{'count':_0x42b9de,'rows':_0x5c699c}:null;}})[_0x077c('0x26')](respondWithResult(_0x4beab1,null))['catch'](handleError(_0x4beab1,null));};
\ No newline at end of file
+var _0x02f5=['save','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','update','getFields','findOne','ZohoField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject'];(function(_0x4f06d3,_0x445507){var _0x322e62=function(_0x59a7c6){while(--_0x59a7c6){_0x4f06d3['push'](_0x4f06d3['shift']());}};_0x322e62(++_0x445507);}(_0x02f5,0xc7));var _0x502f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x02f5[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0x502f('0x0'));var rimraf=require(_0x502f('0x1'));var zipdir=require(_0x502f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x502f('0x3'));var moment=require(_0x502f('0x4'));var BPromise=require(_0x502f('0x5'));var Mustache=require(_0x502f('0x6'));var util=require(_0x502f('0x7'));var path=require(_0x502f('0x8'));var sox=require(_0x502f('0x9'));var csv=require(_0x502f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x502f('0xb'));var _=require(_0x502f('0xc'));var squel=require(_0x502f('0xd'));var crypto=require(_0x502f('0xe'));var jsforce=require(_0x502f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x502f('0xa'));var querystring=require(_0x502f('0x10'));var Papa=require(_0x502f('0x11'));var Redis=require(_0x502f('0x12'));var authService=require(_0x502f('0x13'));var qs=require(_0x502f('0x14'));var as=require(_0x502f('0x15'));var hardwareService=require(_0x502f('0x16'));var logger=require('../../config/logger')(_0x502f('0x17'));var utils=require('../../config/utils');var config=require(_0x502f('0x18'));var licenseUtil=require(_0x502f('0x19'));var db=require(_0x502f('0x1a'))['db'];function respondWithStatusCode(_0x294fb2,_0x130837){_0x130837=_0x130837||0xcc;return function(_0x163256){if(_0x163256){return _0x294fb2[_0x502f('0x1b')](_0x130837);}return _0x294fb2[_0x502f('0x1c')](_0x130837)['end']();};}function respondWithResult(_0x55a89b,_0x2b12be){_0x2b12be=_0x2b12be||0xc8;return function(_0x2bdc0f){if(_0x2bdc0f){return _0x55a89b[_0x502f('0x1c')](_0x2b12be)['json'](_0x2bdc0f);}};}function respondWithFilteredResult(_0x562219,_0x4b7f69){return function(_0x42d39c){if(_0x42d39c){var _0x5de7e4=typeof _0x4b7f69[_0x502f('0x1d')]===_0x502f('0x1e')&&typeof _0x4b7f69[_0x502f('0x1f')]==='undefined';var _0x47826e=_0x42d39c[_0x502f('0x20')];var _0x5c75ca=_0x5de7e4?0x0:_0x4b7f69[_0x502f('0x1d')];var _0x5f5934=_0x5de7e4?_0x42d39c[_0x502f('0x20')]:_0x4b7f69['offset']+_0x4b7f69[_0x502f('0x1f')];var _0x7c62d3;if(_0x5f5934>=_0x47826e){_0x5f5934=_0x47826e;_0x7c62d3=0xc8;}else{_0x7c62d3=0xce;}_0x562219[_0x502f('0x1c')](_0x7c62d3);return _0x562219[_0x502f('0x21')]('Content-Range',_0x5c75ca+'-'+_0x5f5934+'/'+_0x47826e)['json'](_0x42d39c);}return null;};}function patchUpdates(_0x5137b7){return function(_0xbc5cab){try{jsonpatch['apply'](_0xbc5cab,_0x5137b7,!![]);}catch(_0x334985){return BPromise[_0x502f('0x22')](_0x334985);}return _0xbc5cab[_0x502f('0x23')]();};}function saveUpdates(_0x4d30df,_0x190cf9){return function(_0x176055){if(_0x176055){return _0x176055['update'](_0x4d30df)[_0x502f('0x24')](function(_0xef7a4b){return _0xef7a4b;});}return null;};}function removeEntity(_0x3b540c,_0x94c91c){return function(_0xb6cfea){if(_0xb6cfea){return _0xb6cfea[_0x502f('0x25')]()['then'](function(){_0x3b540c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45bac6,_0x423a8d){return function(_0x4a9b32){if(!_0x4a9b32){_0x45bac6[_0x502f('0x1b')](0x194);}return _0x4a9b32;};}function handleError(_0x585389,_0x25a97e){_0x25a97e=_0x25a97e||0x1f4;return function(_0x10d637){logger['error'](_0x10d637[_0x502f('0x26')]);if(_0x10d637[_0x502f('0x27')]){delete _0x10d637[_0x502f('0x27')];}_0x585389['status'](_0x25a97e)[_0x502f('0x28')](_0x10d637);};}exports[_0x502f('0x29')]=function(_0x45badd,_0x3518a6){var _0x3036bc={},_0x60a1e8={},_0x54fa5b={'count':0x0,'rows':[]};var _0xa28cd=_[_0x502f('0x2a')](db[_0x502f('0x2b')][_0x502f('0x2c')],function(_0x9b6404){return{'name':_0x9b6404['fieldName'],'type':_0x9b6404['type'][_0x502f('0x2d')]};});_0x60a1e8[_0x502f('0x2e')]=_[_0x502f('0x2a')](_0xa28cd,_0x502f('0x27'));_0x60a1e8[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x45badd[_0x502f('0x2f')]);_0x60a1e8[_0x502f('0x31')]=_['intersection'](_0x60a1e8[_0x502f('0x2e')],_0x60a1e8[_0x502f('0x2f')]);_0x3036bc['attributes']=_['intersection'](_0x60a1e8[_0x502f('0x2e')],qs[_0x502f('0x32')](_0x45badd[_0x502f('0x2f')][_0x502f('0x32')]));_0x3036bc[_0x502f('0x33')]=_0x3036bc[_0x502f('0x33')][_0x502f('0x34')]?_0x3036bc[_0x502f('0x33')]:_0x60a1e8[_0x502f('0x2e')];if(!_0x45badd['query'][_0x502f('0x35')]('nolimit')){_0x3036bc['limit']=qs[_0x502f('0x1f')](_0x45badd[_0x502f('0x2f')]['limit']);_0x3036bc[_0x502f('0x1d')]=qs[_0x502f('0x1d')](_0x45badd[_0x502f('0x2f')][_0x502f('0x1d')]);}_0x3036bc['order']=qs[_0x502f('0x36')](_0x45badd[_0x502f('0x2f')]['sort']);_0x3036bc[_0x502f('0x37')]=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0x45badd[_0x502f('0x2f')],_0x60a1e8['filters']),_0xa28cd);if(_0x45badd[_0x502f('0x2f')][_0x502f('0x39')]){_0x3036bc['where']=_[_0x502f('0x3a')](_0x3036bc[_0x502f('0x37')],{'$or':_[_0x502f('0x2a')](_0xa28cd,function(_0x72e9cb){if(_0x72e9cb['type']!=='VIRTUAL'){var _0x58c443={};_0x58c443[_0x72e9cb[_0x502f('0x27')]]={'$like':'%'+_0x45badd[_0x502f('0x2f')]['filter']+'%'};return _0x58c443;}})});}_0x3036bc=_[_0x502f('0x3a')]({},_0x3036bc,_0x45badd[_0x502f('0x3b')]);var _0x1d58b6={'where':_0x3036bc[_0x502f('0x37')]};return db[_0x502f('0x2b')][_0x502f('0x20')](_0x1d58b6)[_0x502f('0x24')](function(_0x134539){_0x54fa5b['count']=_0x134539;if(_0x45badd['query'][_0x502f('0x3c')]){_0x3036bc['include']=[{'all':!![]}];}return db[_0x502f('0x2b')][_0x502f('0x3d')](_0x3036bc);})[_0x502f('0x24')](function(_0x429e50){_0x54fa5b[_0x502f('0x3e')]=_0x429e50;return _0x54fa5b;})[_0x502f('0x24')](respondWithFilteredResult(_0x3518a6,_0x3036bc))[_0x502f('0x3f')](handleError(_0x3518a6,null));};exports[_0x502f('0x40')]=function(_0x3e61cf,_0x48da5a){var _0x33706f={'raw':![],'where':{'id':_0x3e61cf[_0x502f('0x41')]['id']}},_0x219ff7={};_0x219ff7[_0x502f('0x2e')]=_['keys'](db[_0x502f('0x2b')][_0x502f('0x2c')]);_0x219ff7[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x3e61cf[_0x502f('0x2f')]);_0x219ff7[_0x502f('0x31')]=_[_0x502f('0x42')](_0x219ff7['model'],_0x219ff7[_0x502f('0x2f')]);_0x33706f[_0x502f('0x33')]=_['intersection'](_0x219ff7['model'],qs[_0x502f('0x32')](_0x3e61cf['query'][_0x502f('0x32')]));_0x33706f[_0x502f('0x33')]=_0x33706f[_0x502f('0x33')][_0x502f('0x34')]?_0x33706f['attributes']:_0x219ff7['model'];if(_0x3e61cf[_0x502f('0x2f')][_0x502f('0x3c')]){_0x33706f['include']=[{'all':!![]}];}_0x33706f=_['merge']({},_0x33706f,_0x3e61cf[_0x502f('0x3b')]);return db['ZohoConfiguration'][_0x502f('0x43')](_0x33706f)[_0x502f('0x24')](handleEntityNotFound(_0x48da5a,null))[_0x502f('0x24')](respondWithResult(_0x48da5a,null))[_0x502f('0x3f')](handleError(_0x48da5a,null));};exports[_0x502f('0x44')]=function(_0x52efcc,_0x94e36){return db['ZohoConfiguration'][_0x502f('0x44')](_0x52efcc[_0x502f('0x45')],{})[_0x502f('0x24')](respondWithResult(_0x94e36,0xc9))[_0x502f('0x3f')](handleError(_0x94e36,null));};exports[_0x502f('0x46')]=function(_0x4733b0,_0x415628){if(_0x4733b0['body']['id']){delete _0x4733b0[_0x502f('0x45')]['id'];}return db['ZohoConfiguration'][_0x502f('0x43')]({'where':{'id':_0x4733b0['params']['id']}})[_0x502f('0x24')](handleEntityNotFound(_0x415628,null))[_0x502f('0x24')](saveUpdates(_0x4733b0[_0x502f('0x45')],null))[_0x502f('0x24')](respondWithResult(_0x415628,null))[_0x502f('0x3f')](handleError(_0x415628,null));};exports[_0x502f('0x25')]=function(_0x508ac1,_0x175516){return db['ZohoConfiguration'][_0x502f('0x43')]({'where':{'id':_0x508ac1['params']['id']}})[_0x502f('0x24')](handleEntityNotFound(_0x175516,null))[_0x502f('0x24')](removeEntity(_0x175516,null))[_0x502f('0x3f')](handleError(_0x175516,null));};exports[_0x502f('0x47')]=function(_0x2a74cf,_0x3b249a,_0x5f1001){var _0x5a2b6a={};var _0x3df9de={};var _0xa167bd;var _0x1dbbc4;return db[_0x502f('0x2b')][_0x502f('0x48')]({'where':{'id':_0x2a74cf['params']['id']}})[_0x502f('0x24')](handleEntityNotFound(_0x3b249a,null))[_0x502f('0x24')](function(_0x204fee){if(_0x204fee){_0xa167bd=_0x204fee;_0x3df9de[_0x502f('0x2e')]=_[_0x502f('0x30')](db[_0x502f('0x49')]['rawAttributes']);_0x3df9de[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x2a74cf[_0x502f('0x2f')]);_0x3df9de[_0x502f('0x31')]=_['intersection'](_0x3df9de[_0x502f('0x2e')],_0x3df9de[_0x502f('0x2f')]);_0x5a2b6a['attributes']=_[_0x502f('0x42')](_0x3df9de['model'],qs[_0x502f('0x32')](_0x2a74cf['query'][_0x502f('0x32')]));_0x5a2b6a['attributes']=_0x5a2b6a['attributes']['length']?_0x5a2b6a[_0x502f('0x33')]:_0x3df9de[_0x502f('0x2e')];_0x5a2b6a[_0x502f('0x4a')]=qs[_0x502f('0x36')](_0x2a74cf['query'][_0x502f('0x36')]);_0x5a2b6a['where']=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0x2a74cf['query'],_0x3df9de[_0x502f('0x31')]));if(_0x2a74cf[_0x502f('0x2f')][_0x502f('0x39')]){_0x5a2b6a[_0x502f('0x37')]=_[_0x502f('0x3a')](_0x5a2b6a[_0x502f('0x37')],{'$or':_[_0x502f('0x2a')](_0x5a2b6a[_0x502f('0x33')],function(_0x332add){var _0x4e4d0b={};_0x4e4d0b[_0x332add]={'$like':'%'+_0x2a74cf[_0x502f('0x2f')]['filter']+'%'};return _0x4e4d0b;})});}_0x5a2b6a=_[_0x502f('0x3a')]({},_0x5a2b6a,_0x2a74cf[_0x502f('0x3b')]);return _0xa167bd[_0x502f('0x47')](_0x5a2b6a);}})['then'](function(_0x468a06){if(_0x468a06){_0x1dbbc4=_0x468a06[_0x502f('0x34')];if(!_0x2a74cf['query'][_0x502f('0x35')](_0x502f('0x4b'))){_0x5a2b6a['limit']=qs['limit'](_0x2a74cf[_0x502f('0x2f')][_0x502f('0x1f')]);_0x5a2b6a[_0x502f('0x1d')]=qs[_0x502f('0x1d')](_0x2a74cf[_0x502f('0x2f')]['offset']);}return _0xa167bd['getFields'](_0x5a2b6a);}})[_0x502f('0x24')](function(_0x176737){if(_0x176737){return _0x176737?{'count':_0x1dbbc4,'rows':_0x176737}:null;}})[_0x502f('0x24')](respondWithResult(_0x3b249a,null))[_0x502f('0x3f')](handleError(_0x3b249a,null));};exports[_0x502f('0x4c')]=function(_0x2a66ae,_0x15f17f,_0xf28153){var _0x308929={};var _0x17ee21={};var _0x10940c;var _0x1e5ee5;return db[_0x502f('0x2b')][_0x502f('0x48')]({'where':{'id':_0x2a66ae[_0x502f('0x41')]['id']}})['then'](handleEntityNotFound(_0x15f17f,null))[_0x502f('0x24')](function(_0x2196dd){if(_0x2196dd){_0x10940c=_0x2196dd;_0x17ee21[_0x502f('0x2e')]=_['keys'](db[_0x502f('0x49')]['rawAttributes']);_0x17ee21[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x2a66ae[_0x502f('0x2f')]);_0x17ee21[_0x502f('0x31')]=_['intersection'](_0x17ee21[_0x502f('0x2e')],_0x17ee21[_0x502f('0x2f')]);_0x308929[_0x502f('0x33')]=_[_0x502f('0x42')](_0x17ee21[_0x502f('0x2e')],qs['fields'](_0x2a66ae[_0x502f('0x2f')][_0x502f('0x32')]));_0x308929[_0x502f('0x33')]=_0x308929[_0x502f('0x33')][_0x502f('0x34')]?_0x308929['attributes']:_0x17ee21[_0x502f('0x2e')];_0x308929['order']=qs[_0x502f('0x36')](_0x2a66ae[_0x502f('0x2f')][_0x502f('0x36')]);_0x308929['where']=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0x2a66ae['query'],_0x17ee21['filters']));if(_0x2a66ae[_0x502f('0x2f')][_0x502f('0x39')]){_0x308929[_0x502f('0x37')]=_[_0x502f('0x3a')](_0x308929[_0x502f('0x37')],{'$or':_[_0x502f('0x2a')](_0x308929[_0x502f('0x33')],function(_0x53d776){var _0x31e407={};_0x31e407[_0x53d776]={'$like':'%'+_0x2a66ae['query'][_0x502f('0x39')]+'%'};return _0x31e407;})});}_0x308929=_[_0x502f('0x3a')]({},_0x308929,_0x2a66ae[_0x502f('0x3b')]);return _0x10940c[_0x502f('0x4c')](_0x308929);}})[_0x502f('0x24')](function(_0x496f7f){if(_0x496f7f){_0x1e5ee5=_0x496f7f[_0x502f('0x34')];if(!_0x2a66ae[_0x502f('0x2f')]['hasOwnProperty'](_0x502f('0x4b'))){_0x308929[_0x502f('0x1f')]=qs[_0x502f('0x1f')](_0x2a66ae[_0x502f('0x2f')]['limit']);_0x308929[_0x502f('0x1d')]=qs[_0x502f('0x1d')](_0x2a66ae[_0x502f('0x2f')][_0x502f('0x1d')]);}return _0x10940c['getSubjects'](_0x308929);}})[_0x502f('0x24')](function(_0x314ccc){if(_0x314ccc){return _0x314ccc?{'count':_0x1e5ee5,'rows':_0x314ccc}:null;}})[_0x502f('0x24')](respondWithResult(_0x15f17f,null))[_0x502f('0x3f')](handleError(_0x15f17f,null));};exports[_0x502f('0x4d')]=function(_0xabed49,_0x3536b9,_0x18f0f4){var _0x3e20dd={};var _0x4a6525={};var _0x2492c1;var _0x3ce344;return db[_0x502f('0x2b')]['findOne']({'where':{'id':_0xabed49['params']['id']}})['then'](handleEntityNotFound(_0x3536b9,null))[_0x502f('0x24')](function(_0x15e8b9){if(_0x15e8b9){_0x2492c1=_0x15e8b9;_0x4a6525[_0x502f('0x2e')]=_[_0x502f('0x30')](db[_0x502f('0x49')][_0x502f('0x2c')]);_0x4a6525[_0x502f('0x2f')]=_[_0x502f('0x30')](_0xabed49['query']);_0x4a6525[_0x502f('0x31')]=_[_0x502f('0x42')](_0x4a6525[_0x502f('0x2e')],_0x4a6525[_0x502f('0x2f')]);_0x3e20dd[_0x502f('0x33')]=_[_0x502f('0x42')](_0x4a6525[_0x502f('0x2e')],qs[_0x502f('0x32')](_0xabed49['query'][_0x502f('0x32')]));_0x3e20dd[_0x502f('0x33')]=_0x3e20dd[_0x502f('0x33')][_0x502f('0x34')]?_0x3e20dd[_0x502f('0x33')]:_0x4a6525[_0x502f('0x2e')];_0x3e20dd[_0x502f('0x4a')]=qs[_0x502f('0x36')](_0xabed49[_0x502f('0x2f')][_0x502f('0x36')]);_0x3e20dd[_0x502f('0x37')]=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0xabed49[_0x502f('0x2f')],_0x4a6525[_0x502f('0x31')]));if(_0xabed49[_0x502f('0x2f')][_0x502f('0x39')]){_0x3e20dd[_0x502f('0x37')]=_['merge'](_0x3e20dd['where'],{'$or':_[_0x502f('0x2a')](_0x3e20dd[_0x502f('0x33')],function(_0x3e0794){var _0x36bef6={};_0x36bef6[_0x3e0794]={'$like':'%'+_0xabed49['query']['filter']+'%'};return _0x36bef6;})});}_0x3e20dd=_[_0x502f('0x3a')]({},_0x3e20dd,_0xabed49[_0x502f('0x3b')]);return _0x2492c1[_0x502f('0x4d')](_0x3e20dd);}})[_0x502f('0x24')](function(_0x37fb44){if(_0x37fb44){_0x3ce344=_0x37fb44[_0x502f('0x34')];if(!_0xabed49[_0x502f('0x2f')][_0x502f('0x35')](_0x502f('0x4b'))){_0x3e20dd[_0x502f('0x1f')]=qs['limit'](_0xabed49['query']['limit']);_0x3e20dd[_0x502f('0x1d')]=qs['offset'](_0xabed49[_0x502f('0x2f')][_0x502f('0x1d')]);}return _0x2492c1[_0x502f('0x4d')](_0x3e20dd);}})[_0x502f('0x24')](function(_0x471e7a){if(_0x471e7a){return _0x471e7a?{'count':_0x3ce344,'rows':_0x471e7a}:null;}})['then'](respondWithResult(_0x3536b9,null))[_0x502f('0x3f')](handleError(_0x3536b9,null));};
\ No newline at end of file