Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / intZohoConfiguration / intZohoConfiguration.controller.js
index 16308e6..4d96701 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x994c=['include','rows','catch','show','params','find','create','body','findOne','ZohoField','order','filter','hasOwnProperty','getFields','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','options','ZohoConfiguration','includeAll'];(function(_0x53e7f4,_0x7709ce){var _0x17b660=function(_0x1d9352){while(--_0x1d9352){_0x53e7f4['push'](_0x53e7f4['shift']());}};_0x17b660(++_0x7709ce);}(_0x994c,0xfe));var _0xc994=function(_0x5d9465,_0x257fdd){_0x5d9465=_0x5d9465-0x0;var _0xeda10e=_0x994c[_0x5d9465];return _0xeda10e;};'use strict';var emlformat=require(_0xc994('0x0'));var rimraf=require(_0xc994('0x1'));var zipdir=require(_0xc994('0x2'));var jsonpatch=require(_0xc994('0x3'));var rp=require(_0xc994('0x4'));var moment=require(_0xc994('0x5'));var BPromise=require(_0xc994('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc994('0x7'));var sox=require(_0xc994('0x8'));var csv=require(_0xc994('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc994('0xa'));var _=require(_0xc994('0xb'));var squel=require('squel');var crypto=require(_0xc994('0xc'));var jsforce=require(_0xc994('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc994('0x9'));var querystring=require(_0xc994('0xe'));var Papa=require(_0xc994('0xf'));var Redis=require('ioredis');var authService=require(_0xc994('0x10'));var qs=require(_0xc994('0x11'));var as=require(_0xc994('0x12'));var hardwareService=require(_0xc994('0x13'));var logger=require(_0xc994('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc994('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc994('0x16'))['db'];function respondWithStatusCode(_0x398b3f,_0x414a){_0x414a=_0x414a||0xcc;return function(_0x3dffc9){if(_0x3dffc9){return _0x398b3f[_0xc994('0x17')](_0x414a);}return _0x398b3f['status'](_0x414a)[_0xc994('0x18')]();};}function respondWithResult(_0x100e9e,_0x1d53cd){_0x1d53cd=_0x1d53cd||0xc8;return function(_0x28e8f2){if(_0x28e8f2){return _0x100e9e[_0xc994('0x19')](_0x1d53cd)[_0xc994('0x1a')](_0x28e8f2);}};}function respondWithFilteredResult(_0x5091a9,_0x6e1407){return function(_0x16945b){if(_0x16945b){var _0x3c052d=typeof _0x6e1407[_0xc994('0x1b')]===_0xc994('0x1c')&&typeof _0x6e1407[_0xc994('0x1d')]==='undefined';var _0x26adc5=_0x16945b[_0xc994('0x1e')];var _0x197ebb=_0x3c052d?0x0:_0x6e1407[_0xc994('0x1b')];var _0x421a5b=_0x3c052d?_0x16945b['count']:_0x6e1407['offset']+_0x6e1407['limit'];var _0x2ceb16;if(_0x421a5b>=_0x26adc5){_0x421a5b=_0x26adc5;_0x2ceb16=0xc8;}else{_0x2ceb16=0xce;}_0x5091a9[_0xc994('0x19')](_0x2ceb16);return _0x5091a9[_0xc994('0x1f')](_0xc994('0x20'),_0x197ebb+'-'+_0x421a5b+'/'+_0x26adc5)[_0xc994('0x1a')](_0x16945b);}return null;};}function patchUpdates(_0x1167c8){return function(_0x2710b0){try{jsonpatch[_0xc994('0x21')](_0x2710b0,_0x1167c8,!![]);}catch(_0x1fc294){return BPromise[_0xc994('0x22')](_0x1fc294);}return _0x2710b0['save']();};}function saveUpdates(_0x26a13a,_0x4f1090){return function(_0x27785b){if(_0x27785b){return _0x27785b[_0xc994('0x23')](_0x26a13a)[_0xc994('0x24')](function(_0x50adae){return _0x50adae;});}return null;};}function removeEntity(_0x38094e,_0x1213ce){return function(_0x184051){if(_0x184051){return _0x184051[_0xc994('0x25')]()[_0xc994('0x24')](function(){_0x38094e[_0xc994('0x19')](0xcc)[_0xc994('0x18')]();});}};}function handleEntityNotFound(_0x25e675,_0x2d6336){return function(_0x2c7666){if(!_0x2c7666){_0x25e675['sendStatus'](0x194);}return _0x2c7666;};}function handleError(_0x1a4720,_0x201d5e){_0x201d5e=_0x201d5e||0x1f4;return function(_0x495bd8){logger[_0xc994('0x26')](_0x495bd8[_0xc994('0x27')]);if(_0x495bd8[_0xc994('0x28')]){delete _0x495bd8['name'];}_0x1a4720[_0xc994('0x19')](_0x201d5e)['send'](_0x495bd8);};}exports[_0xc994('0x29')]=function(_0x217563,_0x4188f5){var _0x33aafa={},_0x2484fc={},_0x27ee8a={'count':0x0,'rows':[]};var _0x26ae70=_[_0xc994('0x2a')](db['ZohoConfiguration'][_0xc994('0x2b')],function(_0x29d34f){return{'name':_0x29d34f[_0xc994('0x2c')],'type':_0x29d34f[_0xc994('0x2d')]['key']};});_0x2484fc[_0xc994('0x2e')]=_['map'](_0x26ae70,'name');_0x2484fc[_0xc994('0x2f')]=_[_0xc994('0x30')](_0x217563[_0xc994('0x2f')]);_0x2484fc[_0xc994('0x31')]=_[_0xc994('0x32')](_0x2484fc[_0xc994('0x2e')],_0x2484fc[_0xc994('0x2f')]);_0x33aafa[_0xc994('0x33')]=_[_0xc994('0x32')](_0x2484fc[_0xc994('0x2e')],qs[_0xc994('0x34')](_0x217563[_0xc994('0x2f')][_0xc994('0x34')]));_0x33aafa[_0xc994('0x33')]=_0x33aafa[_0xc994('0x33')][_0xc994('0x35')]?_0x33aafa[_0xc994('0x33')]:_0x2484fc['model'];if(!_0x217563[_0xc994('0x2f')]['hasOwnProperty'](_0xc994('0x36'))){_0x33aafa[_0xc994('0x1d')]=qs['limit'](_0x217563[_0xc994('0x2f')][_0xc994('0x1d')]);_0x33aafa['offset']=qs[_0xc994('0x1b')](_0x217563[_0xc994('0x2f')][_0xc994('0x1b')]);}_0x33aafa['order']=qs[_0xc994('0x37')](_0x217563['query'][_0xc994('0x37')]);_0x33aafa['where']=qs['filters'](_['pick'](_0x217563[_0xc994('0x2f')],_0x2484fc[_0xc994('0x31')]),_0x26ae70);if(_0x217563[_0xc994('0x2f')]['filter']){_0x33aafa[_0xc994('0x38')]=_[_0xc994('0x39')](_0x33aafa['where'],{'$or':_['map'](_0x26ae70,function(_0x46210d){if(_0x46210d['type']!==_0xc994('0x3a')){var _0x191438={};_0x191438[_0x46210d[_0xc994('0x28')]]={'$like':'%'+_0x217563['query']['filter']+'%'};return _0x191438;}})});}_0x33aafa=_[_0xc994('0x39')]({},_0x33aafa,_0x217563[_0xc994('0x3b')]);var _0x1985b8={'where':_0x33aafa[_0xc994('0x38')]};return db[_0xc994('0x3c')][_0xc994('0x1e')](_0x1985b8)['then'](function(_0x2fa14b){_0x27ee8a[_0xc994('0x1e')]=_0x2fa14b;if(_0x217563[_0xc994('0x2f')][_0xc994('0x3d')]){_0x33aafa[_0xc994('0x3e')]=[{'all':!![]}];}return db[_0xc994('0x3c')]['findAll'](_0x33aafa);})['then'](function(_0x222eb2){_0x27ee8a[_0xc994('0x3f')]=_0x222eb2;return _0x27ee8a;})[_0xc994('0x24')](respondWithFilteredResult(_0x4188f5,_0x33aafa))[_0xc994('0x40')](handleError(_0x4188f5,null));};exports[_0xc994('0x41')]=function(_0x3132e5,_0x259efb){var _0xdf9398={'raw':![],'where':{'id':_0x3132e5[_0xc994('0x42')]['id']}},_0x2b45e3={};_0x2b45e3[_0xc994('0x2e')]=_[_0xc994('0x30')](db[_0xc994('0x3c')][_0xc994('0x2b')]);_0x2b45e3[_0xc994('0x2f')]=_['keys'](_0x3132e5[_0xc994('0x2f')]);_0x2b45e3[_0xc994('0x31')]=_[_0xc994('0x32')](_0x2b45e3['model'],_0x2b45e3[_0xc994('0x2f')]);_0xdf9398['attributes']=_[_0xc994('0x32')](_0x2b45e3[_0xc994('0x2e')],qs[_0xc994('0x34')](_0x3132e5[_0xc994('0x2f')][_0xc994('0x34')]));_0xdf9398[_0xc994('0x33')]=_0xdf9398[_0xc994('0x33')][_0xc994('0x35')]?_0xdf9398['attributes']:_0x2b45e3['model'];if(_0x3132e5[_0xc994('0x2f')][_0xc994('0x3d')]){_0xdf9398[_0xc994('0x3e')]=[{'all':!![]}];}_0xdf9398=_[_0xc994('0x39')]({},_0xdf9398,_0x3132e5[_0xc994('0x3b')]);return db['ZohoConfiguration'][_0xc994('0x43')](_0xdf9398)['then'](handleEntityNotFound(_0x259efb,null))[_0xc994('0x24')](respondWithResult(_0x259efb,null))['catch'](handleError(_0x259efb,null));};exports['create']=function(_0x409697,_0x19dacf){return db[_0xc994('0x3c')][_0xc994('0x44')](_0x409697[_0xc994('0x45')],{})['then'](respondWithResult(_0x19dacf,0xc9))[_0xc994('0x40')](handleError(_0x19dacf,null));};exports['update']=function(_0x38450a,_0x3af92d){if(_0x38450a[_0xc994('0x45')]['id']){delete _0x38450a[_0xc994('0x45')]['id'];}return db[_0xc994('0x3c')]['find']({'where':{'id':_0x38450a[_0xc994('0x42')]['id']}})[_0xc994('0x24')](handleEntityNotFound(_0x3af92d,null))[_0xc994('0x24')](saveUpdates(_0x38450a['body'],null))[_0xc994('0x24')](respondWithResult(_0x3af92d,null))[_0xc994('0x40')](handleError(_0x3af92d,null));};exports[_0xc994('0x25')]=function(_0x250572,_0x46a9a8){return db[_0xc994('0x3c')][_0xc994('0x43')]({'where':{'id':_0x250572[_0xc994('0x42')]['id']}})['then'](handleEntityNotFound(_0x46a9a8,null))['then'](removeEntity(_0x46a9a8,null))[_0xc994('0x40')](handleError(_0x46a9a8,null));};exports['getFields']=function(_0x3ebb79,_0x5a094d,_0x28b0c6){var _0x3bea0e={};var _0x3fe513={};var _0x14942a;var _0x3fb3af;return db[_0xc994('0x3c')][_0xc994('0x46')]({'where':{'id':_0x3ebb79[_0xc994('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a094d,null))[_0xc994('0x24')](function(_0x3da412){if(_0x3da412){_0x14942a=_0x3da412;_0x3fe513[_0xc994('0x2e')]=_[_0xc994('0x30')](db[_0xc994('0x47')][_0xc994('0x2b')]);_0x3fe513[_0xc994('0x2f')]=_[_0xc994('0x30')](_0x3ebb79[_0xc994('0x2f')]);_0x3fe513[_0xc994('0x31')]=_[_0xc994('0x32')](_0x3fe513[_0xc994('0x2e')],_0x3fe513[_0xc994('0x2f')]);_0x3bea0e[_0xc994('0x33')]=_['intersection'](_0x3fe513[_0xc994('0x2e')],qs[_0xc994('0x34')](_0x3ebb79[_0xc994('0x2f')]['fields']));_0x3bea0e['attributes']=_0x3bea0e[_0xc994('0x33')][_0xc994('0x35')]?_0x3bea0e[_0xc994('0x33')]:_0x3fe513[_0xc994('0x2e')];_0x3bea0e[_0xc994('0x48')]=qs[_0xc994('0x37')](_0x3ebb79[_0xc994('0x2f')][_0xc994('0x37')]);_0x3bea0e['where']=qs[_0xc994('0x31')](_['pick'](_0x3ebb79[_0xc994('0x2f')],_0x3fe513[_0xc994('0x31')]));if(_0x3ebb79[_0xc994('0x2f')][_0xc994('0x49')]){_0x3bea0e[_0xc994('0x38')]=_[_0xc994('0x39')](_0x3bea0e[_0xc994('0x38')],{'$or':_[_0xc994('0x2a')](_0x3bea0e[_0xc994('0x33')],function(_0x322899){var _0x4c2400={};_0x4c2400[_0x322899]={'$like':'%'+_0x3ebb79[_0xc994('0x2f')][_0xc994('0x49')]+'%'};return _0x4c2400;})});}_0x3bea0e=_[_0xc994('0x39')]({},_0x3bea0e,_0x3ebb79[_0xc994('0x3b')]);return _0x14942a['getFields'](_0x3bea0e);}})['then'](function(_0x54a500){if(_0x54a500){_0x3fb3af=_0x54a500[_0xc994('0x35')];if(!_0x3ebb79[_0xc994('0x2f')][_0xc994('0x4a')]('nolimit')){_0x3bea0e[_0xc994('0x1d')]=qs[_0xc994('0x1d')](_0x3ebb79[_0xc994('0x2f')]['limit']);_0x3bea0e[_0xc994('0x1b')]=qs['offset'](_0x3ebb79['query']['offset']);}return _0x14942a[_0xc994('0x4b')](_0x3bea0e);}})[_0xc994('0x24')](function(_0x58298e){if(_0x58298e){return _0x58298e?{'count':_0x3fb3af,'rows':_0x58298e}:null;}})['then'](respondWithResult(_0x5a094d,null))[_0xc994('0x40')](handleError(_0x5a094d,null));};exports['getSubjects']=function(_0x4af8a0,_0x51f5d1,_0x56e3e4){var _0x4a9e86={};var _0x143559={};var _0x13e2da;var _0x5bccfd;return db[_0xc994('0x3c')][_0xc994('0x46')]({'where':{'id':_0x4af8a0[_0xc994('0x42')]['id']}})['then'](handleEntityNotFound(_0x51f5d1,null))['then'](function(_0x24fe57){if(_0x24fe57){_0x13e2da=_0x24fe57;_0x143559['model']=_[_0xc994('0x30')](db[_0xc994('0x47')][_0xc994('0x2b')]);_0x143559[_0xc994('0x2f')]=_['keys'](_0x4af8a0[_0xc994('0x2f')]);_0x143559['filters']=_[_0xc994('0x32')](_0x143559['model'],_0x143559[_0xc994('0x2f')]);_0x4a9e86['attributes']=_['intersection'](_0x143559[_0xc994('0x2e')],qs[_0xc994('0x34')](_0x4af8a0['query'][_0xc994('0x34')]));_0x4a9e86[_0xc994('0x33')]=_0x4a9e86[_0xc994('0x33')][_0xc994('0x35')]?_0x4a9e86[_0xc994('0x33')]:_0x143559[_0xc994('0x2e')];_0x4a9e86[_0xc994('0x48')]=qs[_0xc994('0x37')](_0x4af8a0['query']['sort']);_0x4a9e86[_0xc994('0x38')]=qs[_0xc994('0x31')](_[_0xc994('0x4c')](_0x4af8a0[_0xc994('0x2f')],_0x143559[_0xc994('0x31')]));if(_0x4af8a0[_0xc994('0x2f')][_0xc994('0x49')]){_0x4a9e86['where']=_['merge'](_0x4a9e86['where'],{'$or':_[_0xc994('0x2a')](_0x4a9e86[_0xc994('0x33')],function(_0x515d45){var _0x5b8f12={};_0x5b8f12[_0x515d45]={'$like':'%'+_0x4af8a0[_0xc994('0x2f')][_0xc994('0x49')]+'%'};return _0x5b8f12;})});}_0x4a9e86=_[_0xc994('0x39')]({},_0x4a9e86,_0x4af8a0[_0xc994('0x3b')]);return _0x13e2da[_0xc994('0x4d')](_0x4a9e86);}})['then'](function(_0x104669){if(_0x104669){_0x5bccfd=_0x104669['length'];if(!_0x4af8a0['query']['hasOwnProperty'](_0xc994('0x36'))){_0x4a9e86['limit']=qs[_0xc994('0x1d')](_0x4af8a0['query'][_0xc994('0x1d')]);_0x4a9e86['offset']=qs[_0xc994('0x1b')](_0x4af8a0['query'][_0xc994('0x1b')]);}return _0x13e2da['getSubjects'](_0x4a9e86);}})[_0xc994('0x24')](function(_0xff6a55){if(_0xff6a55){return _0xff6a55?{'count':_0x5bccfd,'rows':_0xff6a55}:null;}})[_0xc994('0x24')](respondWithResult(_0x51f5d1,null))[_0xc994('0x40')](handleError(_0x51f5d1,null));};exports[_0xc994('0x4e')]=function(_0x18b8fc,_0x15a858,_0x491e35){var _0x7baafc={};var _0x2d38ca={};var _0x305e7a;var _0x3faef5;return db[_0xc994('0x3c')]['findOne']({'where':{'id':_0x18b8fc['params']['id']}})[_0xc994('0x24')](handleEntityNotFound(_0x15a858,null))[_0xc994('0x24')](function(_0x413546){if(_0x413546){_0x305e7a=_0x413546;_0x2d38ca['model']=_[_0xc994('0x30')](db[_0xc994('0x47')]['rawAttributes']);_0x2d38ca[_0xc994('0x2f')]=_[_0xc994('0x30')](_0x18b8fc[_0xc994('0x2f')]);_0x2d38ca[_0xc994('0x31')]=_[_0xc994('0x32')](_0x2d38ca[_0xc994('0x2e')],_0x2d38ca[_0xc994('0x2f')]);_0x7baafc[_0xc994('0x33')]=_[_0xc994('0x32')](_0x2d38ca['model'],qs[_0xc994('0x34')](_0x18b8fc[_0xc994('0x2f')][_0xc994('0x34')]));_0x7baafc[_0xc994('0x33')]=_0x7baafc[_0xc994('0x33')][_0xc994('0x35')]?_0x7baafc[_0xc994('0x33')]:_0x2d38ca[_0xc994('0x2e')];_0x7baafc[_0xc994('0x48')]=qs[_0xc994('0x37')](_0x18b8fc[_0xc994('0x2f')]['sort']);_0x7baafc[_0xc994('0x38')]=qs['filters'](_[_0xc994('0x4c')](_0x18b8fc[_0xc994('0x2f')],_0x2d38ca['filters']));if(_0x18b8fc[_0xc994('0x2f')][_0xc994('0x49')]){_0x7baafc['where']=_[_0xc994('0x39')](_0x7baafc[_0xc994('0x38')],{'$or':_[_0xc994('0x2a')](_0x7baafc[_0xc994('0x33')],function(_0x3364ce){var _0x4b5309={};_0x4b5309[_0x3364ce]={'$like':'%'+_0x18b8fc[_0xc994('0x2f')][_0xc994('0x49')]+'%'};return _0x4b5309;})});}_0x7baafc=_[_0xc994('0x39')]({},_0x7baafc,_0x18b8fc[_0xc994('0x3b')]);return _0x305e7a['getDescriptions'](_0x7baafc);}})['then'](function(_0xc6d0ee){if(_0xc6d0ee){_0x3faef5=_0xc6d0ee[_0xc994('0x35')];if(!_0x18b8fc[_0xc994('0x2f')][_0xc994('0x4a')](_0xc994('0x36'))){_0x7baafc[_0xc994('0x1d')]=qs[_0xc994('0x1d')](_0x18b8fc[_0xc994('0x2f')][_0xc994('0x1d')]);_0x7baafc[_0xc994('0x1b')]=qs[_0xc994('0x1b')](_0x18b8fc[_0xc994('0x2f')][_0xc994('0x1b')]);}return _0x305e7a[_0xc994('0x4e')](_0x7baafc);}})['then'](function(_0x3073d2){if(_0x3073d2){return _0x3073d2?{'count':_0x3faef5,'rows':_0x3073d2}:null;}})[_0xc994('0x24')](respondWithResult(_0x15a858,null))[_0xc994('0x40')](handleError(_0x15a858,null));};
\ No newline at end of file
+var _0xae6d=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','params','findOne','ZohoField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','ZohoConfiguration','fieldName','key','model','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae6d,0x11b));var _0xdae6=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0xae6d[_0x1a8ff0];return _0x3588bf;};'use strict';var emlformat=require(_0xdae6('0x0'));var rimraf=require(_0xdae6('0x1'));var zipdir=require(_0xdae6('0x2'));var jsonpatch=require(_0xdae6('0x3'));var rp=require(_0xdae6('0x4'));var moment=require(_0xdae6('0x5'));var BPromise=require(_0xdae6('0x6'));var Mustache=require(_0xdae6('0x7'));var util=require(_0xdae6('0x8'));var path=require(_0xdae6('0x9'));var sox=require(_0xdae6('0xa'));var csv=require(_0xdae6('0xb'));var ejs=require(_0xdae6('0xc'));var fs=require('fs');var fs_extra=require(_0xdae6('0xd'));var _=require(_0xdae6('0xe'));var squel=require(_0xdae6('0xf'));var crypto=require('crypto');var jsforce=require(_0xdae6('0x10'));var deskjs=require(_0xdae6('0x11'));var toCsv=require(_0xdae6('0xb'));var querystring=require(_0xdae6('0x12'));var Papa=require(_0xdae6('0x13'));var Redis=require('ioredis');var authService=require(_0xdae6('0x14'));var qs=require(_0xdae6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdae6('0x16'));var logger=require(_0xdae6('0x17'))(_0xdae6('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdae6('0x19'))['db'];function respondWithStatusCode(_0x1c32bb,_0x2b214c){_0x2b214c=_0x2b214c||0xcc;return function(_0x46cf35){if(_0x46cf35){return _0x1c32bb['sendStatus'](_0x2b214c);}return _0x1c32bb['status'](_0x2b214c)[_0xdae6('0x1a')]();};}function respondWithResult(_0x227cbb,_0x3c21c1){_0x3c21c1=_0x3c21c1||0xc8;return function(_0x4086a4){if(_0x4086a4){return _0x227cbb[_0xdae6('0x1b')](_0x3c21c1)['json'](_0x4086a4);}};}function respondWithFilteredResult(_0x308494,_0x4e9d54){return function(_0x41badb){if(_0x41badb){var _0x1e1522=typeof _0x4e9d54[_0xdae6('0x1c')]==='undefined'&&typeof _0x4e9d54[_0xdae6('0x1d')]===_0xdae6('0x1e');var _0x42063f=_0x41badb[_0xdae6('0x1f')];var _0x39f77d=_0x1e1522?0x0:_0x4e9d54[_0xdae6('0x1c')];var _0x62315c=_0x1e1522?_0x41badb[_0xdae6('0x1f')]:_0x4e9d54[_0xdae6('0x1c')]+_0x4e9d54[_0xdae6('0x1d')];var _0x4d895a;if(_0x62315c>=_0x42063f){_0x62315c=_0x42063f;_0x4d895a=0xc8;}else{_0x4d895a=0xce;}_0x308494[_0xdae6('0x1b')](_0x4d895a);return _0x308494[_0xdae6('0x20')]('Content-Range',_0x39f77d+'-'+_0x62315c+'/'+_0x42063f)[_0xdae6('0x21')](_0x41badb);}return null;};}function patchUpdates(_0x155a48){return function(_0x405cd4){try{jsonpatch[_0xdae6('0x22')](_0x405cd4,_0x155a48,!![]);}catch(_0x1af408){return BPromise[_0xdae6('0x23')](_0x1af408);}return _0x405cd4[_0xdae6('0x24')]();};}function saveUpdates(_0x4c236d,_0x490fdb){return function(_0x2c3e99){if(_0x2c3e99){return _0x2c3e99[_0xdae6('0x25')](_0x4c236d)[_0xdae6('0x26')](function(_0x1ff037){return _0x1ff037;});}return null;};}function removeEntity(_0x21dfc4,_0x52f57d){return function(_0x53049b){if(_0x53049b){return _0x53049b[_0xdae6('0x27')]()[_0xdae6('0x26')](function(){_0x21dfc4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e71e,_0x4e1e5f){return function(_0x32d4bc){if(!_0x32d4bc){_0x34e71e[_0xdae6('0x28')](0x194);}return _0x32d4bc;};}function handleError(_0x3d1a09,_0x2c8a96){_0x2c8a96=_0x2c8a96||0x1f4;return function(_0x1fee12){logger['error'](_0x1fee12[_0xdae6('0x29')]);if(_0x1fee12[_0xdae6('0x2a')]){delete _0x1fee12[_0xdae6('0x2a')];}_0x3d1a09[_0xdae6('0x1b')](_0x2c8a96)[_0xdae6('0x2b')](_0x1fee12);};}exports['index']=function(_0xae5b6e,_0x2a3c73){var _0x54cac9={},_0x3c5d3e={},_0x27fd26={'count':0x0,'rows':[]};var _0x503ade=_['map'](db[_0xdae6('0x2c')]['rawAttributes'],function(_0x4ed1ac){return{'name':_0x4ed1ac[_0xdae6('0x2d')],'type':_0x4ed1ac['type'][_0xdae6('0x2e')]};});_0x3c5d3e[_0xdae6('0x2f')]=_[_0xdae6('0x30')](_0x503ade,_0xdae6('0x2a'));_0x3c5d3e[_0xdae6('0x31')]=_[_0xdae6('0x32')](_0xae5b6e[_0xdae6('0x31')]);_0x3c5d3e[_0xdae6('0x33')]=_[_0xdae6('0x34')](_0x3c5d3e[_0xdae6('0x2f')],_0x3c5d3e[_0xdae6('0x31')]);_0x54cac9[_0xdae6('0x35')]=_['intersection'](_0x3c5d3e['model'],qs['fields'](_0xae5b6e[_0xdae6('0x31')][_0xdae6('0x36')]));_0x54cac9[_0xdae6('0x35')]=_0x54cac9[_0xdae6('0x35')]['length']?_0x54cac9['attributes']:_0x3c5d3e[_0xdae6('0x2f')];if(!_0xae5b6e['query'][_0xdae6('0x37')](_0xdae6('0x38'))){_0x54cac9['limit']=qs['limit'](_0xae5b6e['query'][_0xdae6('0x1d')]);_0x54cac9[_0xdae6('0x1c')]=qs[_0xdae6('0x1c')](_0xae5b6e[_0xdae6('0x31')][_0xdae6('0x1c')]);}_0x54cac9[_0xdae6('0x39')]=qs[_0xdae6('0x3a')](_0xae5b6e[_0xdae6('0x31')][_0xdae6('0x3a')]);_0x54cac9[_0xdae6('0x3b')]=qs[_0xdae6('0x33')](_[_0xdae6('0x3c')](_0xae5b6e[_0xdae6('0x31')],_0x3c5d3e['filters']),_0x503ade);if(_0xae5b6e[_0xdae6('0x31')][_0xdae6('0x3d')]){_0x54cac9[_0xdae6('0x3b')]=_[_0xdae6('0x3e')](_0x54cac9[_0xdae6('0x3b')],{'$or':_['map'](_0x503ade,function(_0x56221c){if(_0x56221c[_0xdae6('0x3f')]!==_0xdae6('0x40')){var _0x4d2d93={};_0x4d2d93[_0x56221c['name']]={'$like':'%'+_0xae5b6e[_0xdae6('0x31')][_0xdae6('0x3d')]+'%'};return _0x4d2d93;}})});}_0x54cac9=_[_0xdae6('0x3e')]({},_0x54cac9,_0xae5b6e[_0xdae6('0x41')]);var _0x1fa103={'where':_0x54cac9[_0xdae6('0x3b')]};return db['ZohoConfiguration'][_0xdae6('0x1f')](_0x1fa103)[_0xdae6('0x26')](function(_0x482ce4){_0x27fd26[_0xdae6('0x1f')]=_0x482ce4;if(_0xae5b6e[_0xdae6('0x31')]['includeAll']){_0x54cac9[_0xdae6('0x42')]=[{'all':!![]}];}return db[_0xdae6('0x2c')][_0xdae6('0x43')](_0x54cac9);})[_0xdae6('0x26')](function(_0x436f53){_0x27fd26[_0xdae6('0x44')]=_0x436f53;return _0x27fd26;})[_0xdae6('0x26')](respondWithFilteredResult(_0x2a3c73,_0x54cac9))[_0xdae6('0x45')](handleError(_0x2a3c73,null));};exports[_0xdae6('0x46')]=function(_0xe88e54,_0x2754ac){var _0x2e845f={'raw':![],'where':{'id':_0xe88e54['params']['id']}},_0x9f4b80={};_0x9f4b80[_0xdae6('0x2f')]=_['keys'](db['ZohoConfiguration'][_0xdae6('0x47')]);_0x9f4b80['query']=_[_0xdae6('0x32')](_0xe88e54[_0xdae6('0x31')]);_0x9f4b80[_0xdae6('0x33')]=_['intersection'](_0x9f4b80['model'],_0x9f4b80[_0xdae6('0x31')]);_0x2e845f[_0xdae6('0x35')]=_['intersection'](_0x9f4b80[_0xdae6('0x2f')],qs[_0xdae6('0x36')](_0xe88e54['query']['fields']));_0x2e845f[_0xdae6('0x35')]=_0x2e845f[_0xdae6('0x35')][_0xdae6('0x48')]?_0x2e845f['attributes']:_0x9f4b80['model'];if(_0xe88e54[_0xdae6('0x31')][_0xdae6('0x49')]){_0x2e845f[_0xdae6('0x42')]=[{'all':!![]}];}_0x2e845f=_[_0xdae6('0x3e')]({},_0x2e845f,_0xe88e54[_0xdae6('0x41')]);return db[_0xdae6('0x2c')][_0xdae6('0x4a')](_0x2e845f)['then'](handleEntityNotFound(_0x2754ac,null))[_0xdae6('0x26')](respondWithResult(_0x2754ac,null))[_0xdae6('0x45')](handleError(_0x2754ac,null));};exports[_0xdae6('0x4b')]=function(_0x2bf5c4,_0x32e31d){return db[_0xdae6('0x2c')][_0xdae6('0x4b')](_0x2bf5c4[_0xdae6('0x4c')],{})['then'](respondWithResult(_0x32e31d,0xc9))[_0xdae6('0x45')](handleError(_0x32e31d,null));};exports[_0xdae6('0x25')]=function(_0x3e9bc6,_0x541da7){if(_0x3e9bc6[_0xdae6('0x4c')]['id']){delete _0x3e9bc6[_0xdae6('0x4c')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x3e9bc6['params']['id']}})['then'](handleEntityNotFound(_0x541da7,null))[_0xdae6('0x26')](saveUpdates(_0x3e9bc6[_0xdae6('0x4c')],null))[_0xdae6('0x26')](respondWithResult(_0x541da7,null))[_0xdae6('0x45')](handleError(_0x541da7,null));};exports[_0xdae6('0x27')]=function(_0x11696d,_0x191ac9){return db[_0xdae6('0x2c')][_0xdae6('0x4a')]({'where':{'id':_0x11696d[_0xdae6('0x4d')]['id']}})[_0xdae6('0x26')](handleEntityNotFound(_0x191ac9,null))[_0xdae6('0x26')](removeEntity(_0x191ac9,null))[_0xdae6('0x45')](handleError(_0x191ac9,null));};exports['getFields']=function(_0x47354b,_0x51f5d3,_0x512273){var _0x91c18f={};var _0x8e4dbc={};var _0x35f344;var _0xc15d0;return db[_0xdae6('0x2c')][_0xdae6('0x4e')]({'where':{'id':_0x47354b[_0xdae6('0x4d')]['id']}})[_0xdae6('0x26')](handleEntityNotFound(_0x51f5d3,null))['then'](function(_0xca9435){if(_0xca9435){_0x35f344=_0xca9435;_0x8e4dbc[_0xdae6('0x2f')]=_[_0xdae6('0x32')](db[_0xdae6('0x4f')][_0xdae6('0x47')]);_0x8e4dbc[_0xdae6('0x31')]=_[_0xdae6('0x32')](_0x47354b['query']);_0x8e4dbc['filters']=_[_0xdae6('0x34')](_0x8e4dbc[_0xdae6('0x2f')],_0x8e4dbc[_0xdae6('0x31')]);_0x91c18f[_0xdae6('0x35')]=_[_0xdae6('0x34')](_0x8e4dbc[_0xdae6('0x2f')],qs[_0xdae6('0x36')](_0x47354b[_0xdae6('0x31')][_0xdae6('0x36')]));_0x91c18f[_0xdae6('0x35')]=_0x91c18f['attributes']['length']?_0x91c18f['attributes']:_0x8e4dbc[_0xdae6('0x2f')];_0x91c18f['order']=qs['sort'](_0x47354b[_0xdae6('0x31')][_0xdae6('0x3a')]);_0x91c18f[_0xdae6('0x3b')]=qs[_0xdae6('0x33')](_['pick'](_0x47354b[_0xdae6('0x31')],_0x8e4dbc[_0xdae6('0x33')]));if(_0x47354b[_0xdae6('0x31')][_0xdae6('0x3d')]){_0x91c18f[_0xdae6('0x3b')]=_[_0xdae6('0x3e')](_0x91c18f[_0xdae6('0x3b')],{'$or':_[_0xdae6('0x30')](_0x91c18f[_0xdae6('0x35')],function(_0x47303b){var _0x556716={};_0x556716[_0x47303b]={'$like':'%'+_0x47354b[_0xdae6('0x31')][_0xdae6('0x3d')]+'%'};return _0x556716;})});}_0x91c18f=_[_0xdae6('0x3e')]({},_0x91c18f,_0x47354b['options']);return _0x35f344[_0xdae6('0x50')](_0x91c18f);}})[_0xdae6('0x26')](function(_0x271864){if(_0x271864){_0xc15d0=_0x271864['length'];if(!_0x47354b[_0xdae6('0x31')][_0xdae6('0x37')](_0xdae6('0x38'))){_0x91c18f[_0xdae6('0x1d')]=qs[_0xdae6('0x1d')](_0x47354b[_0xdae6('0x31')][_0xdae6('0x1d')]);_0x91c18f[_0xdae6('0x1c')]=qs[_0xdae6('0x1c')](_0x47354b[_0xdae6('0x31')][_0xdae6('0x1c')]);}return _0x35f344[_0xdae6('0x50')](_0x91c18f);}})[_0xdae6('0x26')](function(_0x2637cb){if(_0x2637cb){return _0x2637cb?{'count':_0xc15d0,'rows':_0x2637cb}:null;}})[_0xdae6('0x26')](respondWithResult(_0x51f5d3,null))[_0xdae6('0x45')](handleError(_0x51f5d3,null));};exports['getSubjects']=function(_0x4b4b7b,_0x3bc1e3,_0x2e95d9){var _0x1461b9={};var _0xb874e={};var _0xd2c85e;var _0x41efbd;return db[_0xdae6('0x2c')][_0xdae6('0x4e')]({'where':{'id':_0x4b4b7b['params']['id']}})[_0xdae6('0x26')](handleEntityNotFound(_0x3bc1e3,null))['then'](function(_0x3f9533){if(_0x3f9533){_0xd2c85e=_0x3f9533;_0xb874e[_0xdae6('0x2f')]=_['keys'](db[_0xdae6('0x4f')][_0xdae6('0x47')]);_0xb874e[_0xdae6('0x31')]=_['keys'](_0x4b4b7b['query']);_0xb874e[_0xdae6('0x33')]=_[_0xdae6('0x34')](_0xb874e[_0xdae6('0x2f')],_0xb874e[_0xdae6('0x31')]);_0x1461b9[_0xdae6('0x35')]=_[_0xdae6('0x34')](_0xb874e[_0xdae6('0x2f')],qs['fields'](_0x4b4b7b['query'][_0xdae6('0x36')]));_0x1461b9[_0xdae6('0x35')]=_0x1461b9[_0xdae6('0x35')][_0xdae6('0x48')]?_0x1461b9[_0xdae6('0x35')]:_0xb874e[_0xdae6('0x2f')];_0x1461b9[_0xdae6('0x39')]=qs[_0xdae6('0x3a')](_0x4b4b7b[_0xdae6('0x31')][_0xdae6('0x3a')]);_0x1461b9[_0xdae6('0x3b')]=qs['filters'](_[_0xdae6('0x3c')](_0x4b4b7b['query'],_0xb874e[_0xdae6('0x33')]));if(_0x4b4b7b[_0xdae6('0x31')][_0xdae6('0x3d')]){_0x1461b9[_0xdae6('0x3b')]=_[_0xdae6('0x3e')](_0x1461b9[_0xdae6('0x3b')],{'$or':_[_0xdae6('0x30')](_0x1461b9['attributes'],function(_0x366298){var _0x49a38a={};_0x49a38a[_0x366298]={'$like':'%'+_0x4b4b7b[_0xdae6('0x31')][_0xdae6('0x3d')]+'%'};return _0x49a38a;})});}_0x1461b9=_[_0xdae6('0x3e')]({},_0x1461b9,_0x4b4b7b[_0xdae6('0x41')]);return _0xd2c85e[_0xdae6('0x51')](_0x1461b9);}})['then'](function(_0x2798f1){if(_0x2798f1){_0x41efbd=_0x2798f1['length'];if(!_0x4b4b7b[_0xdae6('0x31')][_0xdae6('0x37')](_0xdae6('0x38'))){_0x1461b9[_0xdae6('0x1d')]=qs[_0xdae6('0x1d')](_0x4b4b7b['query'][_0xdae6('0x1d')]);_0x1461b9['offset']=qs[_0xdae6('0x1c')](_0x4b4b7b['query']['offset']);}return _0xd2c85e['getSubjects'](_0x1461b9);}})[_0xdae6('0x26')](function(_0x295b6b){if(_0x295b6b){return _0x295b6b?{'count':_0x41efbd,'rows':_0x295b6b}:null;}})[_0xdae6('0x26')](respondWithResult(_0x3bc1e3,null))[_0xdae6('0x45')](handleError(_0x3bc1e3,null));};exports['getDescriptions']=function(_0x513b15,_0x29b8bf,_0x38a90b){var _0x56b2df={};var _0x37db39={};var _0x205cf1;var _0x97ad10;return db[_0xdae6('0x2c')][_0xdae6('0x4e')]({'where':{'id':_0x513b15['params']['id']}})[_0xdae6('0x26')](handleEntityNotFound(_0x29b8bf,null))[_0xdae6('0x26')](function(_0x378b9f){if(_0x378b9f){_0x205cf1=_0x378b9f;_0x37db39[_0xdae6('0x2f')]=_[_0xdae6('0x32')](db[_0xdae6('0x4f')]['rawAttributes']);_0x37db39[_0xdae6('0x31')]=_[_0xdae6('0x32')](_0x513b15[_0xdae6('0x31')]);_0x37db39[_0xdae6('0x33')]=_[_0xdae6('0x34')](_0x37db39[_0xdae6('0x2f')],_0x37db39['query']);_0x56b2df[_0xdae6('0x35')]=_[_0xdae6('0x34')](_0x37db39[_0xdae6('0x2f')],qs['fields'](_0x513b15[_0xdae6('0x31')][_0xdae6('0x36')]));_0x56b2df[_0xdae6('0x35')]=_0x56b2df['attributes'][_0xdae6('0x48')]?_0x56b2df[_0xdae6('0x35')]:_0x37db39['model'];_0x56b2df[_0xdae6('0x39')]=qs['sort'](_0x513b15[_0xdae6('0x31')][_0xdae6('0x3a')]);_0x56b2df[_0xdae6('0x3b')]=qs[_0xdae6('0x33')](_[_0xdae6('0x3c')](_0x513b15['query'],_0x37db39[_0xdae6('0x33')]));if(_0x513b15[_0xdae6('0x31')][_0xdae6('0x3d')]){_0x56b2df[_0xdae6('0x3b')]=_[_0xdae6('0x3e')](_0x56b2df[_0xdae6('0x3b')],{'$or':_['map'](_0x56b2df[_0xdae6('0x35')],function(_0x30c127){var _0x1a6314={};_0x1a6314[_0x30c127]={'$like':'%'+_0x513b15['query'][_0xdae6('0x3d')]+'%'};return _0x1a6314;})});}_0x56b2df=_[_0xdae6('0x3e')]({},_0x56b2df,_0x513b15['options']);return _0x205cf1[_0xdae6('0x52')](_0x56b2df);}})[_0xdae6('0x26')](function(_0xc86f62){if(_0xc86f62){_0x97ad10=_0xc86f62[_0xdae6('0x48')];if(!_0x513b15[_0xdae6('0x31')][_0xdae6('0x37')]('nolimit')){_0x56b2df[_0xdae6('0x1d')]=qs[_0xdae6('0x1d')](_0x513b15[_0xdae6('0x31')][_0xdae6('0x1d')]);_0x56b2df[_0xdae6('0x1c')]=qs[_0xdae6('0x1c')](_0x513b15[_0xdae6('0x31')][_0xdae6('0x1c')]);}return _0x205cf1[_0xdae6('0x52')](_0x56b2df);}})['then'](function(_0x550500){if(_0x550500){return _0x550500?{'count':_0x97ad10,'rows':_0x550500}:null;}})[_0xdae6('0x26')](respondWithResult(_0x29b8bf,null))[_0xdae6('0x45')](handleError(_0x29b8bf,null));};
\ No newline at end of file