Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / intVtigerConfiguration / intVtigerConfiguration.controller.js
index dfbd52a..c8fa50a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe88e=['filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','getFields','VtigerField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL'];(function(_0xcf82b2,_0x49ab9a){var _0x4275e9=function(_0x5b768f){while(--_0x5b768f){_0xcf82b2['push'](_0xcf82b2['shift']());}};_0x4275e9(++_0x49ab9a);}(_0xe88e,0x167));var _0xee88=function(_0x90e9ab,_0x426802){_0x90e9ab=_0x90e9ab-0x0;var _0xdfa58b=_0xe88e[_0x90e9ab];return _0xdfa58b;};'use strict';var emlformat=require(_0xee88('0x0'));var rimraf=require(_0xee88('0x1'));var zipdir=require(_0xee88('0x2'));var jsonpatch=require(_0xee88('0x3'));var rp=require(_0xee88('0x4'));var moment=require(_0xee88('0x5'));var BPromise=require(_0xee88('0x6'));var Mustache=require(_0xee88('0x7'));var util=require(_0xee88('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xee88('0x9'));var ejs=require(_0xee88('0xa'));var fs=require('fs');var fs_extra=require(_0xee88('0xb'));var _=require('lodash');var squel=require(_0xee88('0xc'));var crypto=require(_0xee88('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xee88('0x9'));var querystring=require(_0xee88('0xe'));var Papa=require(_0xee88('0xf'));var Redis=require(_0xee88('0x10'));var authService=require(_0xee88('0x11'));var qs=require(_0xee88('0x12'));var as=require(_0xee88('0x13'));var hardwareService=require(_0xee88('0x14'));var logger=require(_0xee88('0x15'))(_0xee88('0x16'));var utils=require(_0xee88('0x17'));var config=require(_0xee88('0x18'));var licenseUtil=require(_0xee88('0x19'));var db=require(_0xee88('0x1a'))['db'];function respondWithStatusCode(_0x31df35,_0x16c551){_0x16c551=_0x16c551||0xcc;return function(_0x2bde1e){if(_0x2bde1e){return _0x31df35['sendStatus'](_0x16c551);}return _0x31df35[_0xee88('0x1b')](_0x16c551)[_0xee88('0x1c')]();};}function respondWithResult(_0x5f50e0,_0x786409){_0x786409=_0x786409||0xc8;return function(_0xec7f38){if(_0xec7f38){return _0x5f50e0[_0xee88('0x1b')](_0x786409)[_0xee88('0x1d')](_0xec7f38);}};}function respondWithFilteredResult(_0x9d3308,_0x3b78c9){return function(_0xbb7e0d){if(_0xbb7e0d){var _0x23672f=typeof _0x3b78c9['offset']===_0xee88('0x1e')&&typeof _0x3b78c9[_0xee88('0x1f')]==='undefined';var _0x5f117f=_0xbb7e0d['count'];var _0x32000f=_0x23672f?0x0:_0x3b78c9['offset'];var _0xc4d755=_0x23672f?_0xbb7e0d[_0xee88('0x20')]:_0x3b78c9[_0xee88('0x21')]+_0x3b78c9['limit'];var _0x4d9cd9;if(_0xc4d755>=_0x5f117f){_0xc4d755=_0x5f117f;_0x4d9cd9=0xc8;}else{_0x4d9cd9=0xce;}_0x9d3308[_0xee88('0x1b')](_0x4d9cd9);return _0x9d3308[_0xee88('0x22')](_0xee88('0x23'),_0x32000f+'-'+_0xc4d755+'/'+_0x5f117f)[_0xee88('0x1d')](_0xbb7e0d);}return null;};}function patchUpdates(_0x187532){return function(_0x19f575){try{jsonpatch[_0xee88('0x24')](_0x19f575,_0x187532,!![]);}catch(_0x43727e){return BPromise[_0xee88('0x25')](_0x43727e);}return _0x19f575['save']();};}function saveUpdates(_0x4dd2a3,_0x1df7a4){return function(_0xbc67b3){if(_0xbc67b3){return _0xbc67b3[_0xee88('0x26')](_0x4dd2a3)[_0xee88('0x27')](function(_0x1f016f){return _0x1f016f;});}return null;};}function removeEntity(_0x1b5463,_0x15cc82){return function(_0x4e0bd7){if(_0x4e0bd7){return _0x4e0bd7[_0xee88('0x28')]()[_0xee88('0x27')](function(){_0x1b5463[_0xee88('0x1b')](0xcc)[_0xee88('0x1c')]();});}};}function handleEntityNotFound(_0x14376f,_0x1a3bea){return function(_0x2c3d62){if(!_0x2c3d62){_0x14376f[_0xee88('0x29')](0x194);}return _0x2c3d62;};}function handleError(_0x4228f0,_0x280b60){_0x280b60=_0x280b60||0x1f4;return function(_0x3a3ce2){logger[_0xee88('0x2a')](_0x3a3ce2[_0xee88('0x2b')]);if(_0x3a3ce2[_0xee88('0x2c')]){delete _0x3a3ce2[_0xee88('0x2c')];}_0x4228f0[_0xee88('0x1b')](_0x280b60)['send'](_0x3a3ce2);};}exports[_0xee88('0x2d')]=function(_0x3f7c6f,_0x1ddcf6){var _0x3a695d={},_0xadac0c={},_0x44c981={'count':0x0,'rows':[]};var _0x51aaba=_[_0xee88('0x2e')](db[_0xee88('0x2f')][_0xee88('0x30')],function(_0x5b2ee6){return{'name':_0x5b2ee6[_0xee88('0x31')],'type':_0x5b2ee6['type'][_0xee88('0x32')]};});_0xadac0c[_0xee88('0x33')]=_[_0xee88('0x2e')](_0x51aaba,'name');_0xadac0c[_0xee88('0x34')]=_['keys'](_0x3f7c6f['query']);_0xadac0c['filters']=_[_0xee88('0x35')](_0xadac0c[_0xee88('0x33')],_0xadac0c[_0xee88('0x34')]);_0x3a695d[_0xee88('0x36')]=_['intersection'](_0xadac0c[_0xee88('0x33')],qs[_0xee88('0x37')](_0x3f7c6f['query'][_0xee88('0x37')]));_0x3a695d['attributes']=_0x3a695d['attributes']['length']?_0x3a695d[_0xee88('0x36')]:_0xadac0c[_0xee88('0x33')];if(!_0x3f7c6f[_0xee88('0x34')][_0xee88('0x38')](_0xee88('0x39'))){_0x3a695d[_0xee88('0x1f')]=qs[_0xee88('0x1f')](_0x3f7c6f[_0xee88('0x34')][_0xee88('0x1f')]);_0x3a695d[_0xee88('0x21')]=qs[_0xee88('0x21')](_0x3f7c6f[_0xee88('0x34')][_0xee88('0x21')]);}_0x3a695d[_0xee88('0x3a')]=qs[_0xee88('0x3b')](_0x3f7c6f[_0xee88('0x34')][_0xee88('0x3b')]);_0x3a695d[_0xee88('0x3c')]=qs[_0xee88('0x3d')](_[_0xee88('0x3e')](_0x3f7c6f[_0xee88('0x34')],_0xadac0c[_0xee88('0x3d')]),_0x51aaba);if(_0x3f7c6f[_0xee88('0x34')]['filter']){_0x3a695d[_0xee88('0x3c')]=_[_0xee88('0x3f')](_0x3a695d[_0xee88('0x3c')],{'$or':_[_0xee88('0x2e')](_0x51aaba,function(_0x5318cb){if(_0x5318cb[_0xee88('0x40')]!==_0xee88('0x41')){var _0x69365b={};_0x69365b[_0x5318cb[_0xee88('0x2c')]]={'$like':'%'+_0x3f7c6f[_0xee88('0x34')][_0xee88('0x42')]+'%'};return _0x69365b;}})});}_0x3a695d=_[_0xee88('0x3f')]({},_0x3a695d,_0x3f7c6f[_0xee88('0x43')]);var _0x447caf={'where':_0x3a695d[_0xee88('0x3c')]};return db[_0xee88('0x2f')][_0xee88('0x20')](_0x447caf)[_0xee88('0x27')](function(_0x2e7140){_0x44c981[_0xee88('0x20')]=_0x2e7140;if(_0x3f7c6f[_0xee88('0x34')][_0xee88('0x44')]){_0x3a695d[_0xee88('0x45')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xee88('0x46')](_0x3a695d);})[_0xee88('0x27')](function(_0x1ca1b7){_0x44c981[_0xee88('0x47')]=_0x1ca1b7;return _0x44c981;})['then'](respondWithFilteredResult(_0x1ddcf6,_0x3a695d))[_0xee88('0x48')](handleError(_0x1ddcf6,null));};exports[_0xee88('0x49')]=function(_0x286d69,_0x4496db){var _0x30139a={'raw':![],'where':{'id':_0x286d69[_0xee88('0x4a')]['id']}},_0x264629={};_0x264629[_0xee88('0x33')]=_[_0xee88('0x4b')](db[_0xee88('0x2f')][_0xee88('0x30')]);_0x264629['query']=_[_0xee88('0x4b')](_0x286d69[_0xee88('0x34')]);_0x264629[_0xee88('0x3d')]=_[_0xee88('0x35')](_0x264629['model'],_0x264629['query']);_0x30139a[_0xee88('0x36')]=_[_0xee88('0x35')](_0x264629[_0xee88('0x33')],qs[_0xee88('0x37')](_0x286d69[_0xee88('0x34')][_0xee88('0x37')]));_0x30139a['attributes']=_0x30139a[_0xee88('0x36')][_0xee88('0x4c')]?_0x30139a[_0xee88('0x36')]:_0x264629[_0xee88('0x33')];if(_0x286d69['query'][_0xee88('0x44')]){_0x30139a[_0xee88('0x45')]=[{'all':!![]}];}_0x30139a=_['merge']({},_0x30139a,_0x286d69[_0xee88('0x43')]);return db[_0xee88('0x2f')]['find'](_0x30139a)[_0xee88('0x27')](handleEntityNotFound(_0x4496db,null))['then'](respondWithResult(_0x4496db,null))[_0xee88('0x48')](handleError(_0x4496db,null));};exports[_0xee88('0x4d')]=function(_0x506166,_0x31caf2){return db['VtigerConfiguration'][_0xee88('0x4d')](_0x506166[_0xee88('0x4e')],{})[_0xee88('0x27')](respondWithResult(_0x31caf2,0xc9))[_0xee88('0x48')](handleError(_0x31caf2,null));};exports[_0xee88('0x26')]=function(_0x2caf26,_0x5198b0){if(_0x2caf26[_0xee88('0x4e')]['id']){delete _0x2caf26[_0xee88('0x4e')]['id'];}return db[_0xee88('0x2f')][_0xee88('0x4f')]({'where':{'id':_0x2caf26[_0xee88('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5198b0,null))[_0xee88('0x27')](saveUpdates(_0x2caf26[_0xee88('0x4e')],null))['then'](respondWithResult(_0x5198b0,null))['catch'](handleError(_0x5198b0,null));};exports[_0xee88('0x28')]=function(_0x52cd25,_0x263b44){return db[_0xee88('0x2f')][_0xee88('0x4f')]({'where':{'id':_0x52cd25['params']['id']}})['then'](handleEntityNotFound(_0x263b44,null))['then'](removeEntity(_0x263b44,null))[_0xee88('0x48')](handleError(_0x263b44,null));};exports[_0xee88('0x50')]=function(_0x20d3b9,_0x2ba41b,_0x1f41ca){var _0x109db6={};var _0x3aefce={};var _0x13ebfc;var _0x3c3445;return db[_0xee88('0x2f')]['findOne']({'where':{'id':_0x20d3b9[_0xee88('0x4a')]['id']}})[_0xee88('0x27')](handleEntityNotFound(_0x2ba41b,null))[_0xee88('0x27')](function(_0x102114){if(_0x102114){_0x13ebfc=_0x102114;_0x3aefce[_0xee88('0x33')]=_[_0xee88('0x4b')](db[_0xee88('0x51')]['rawAttributes']);_0x3aefce[_0xee88('0x34')]=_[_0xee88('0x4b')](_0x20d3b9[_0xee88('0x34')]);_0x3aefce[_0xee88('0x3d')]=_[_0xee88('0x35')](_0x3aefce[_0xee88('0x33')],_0x3aefce[_0xee88('0x34')]);_0x109db6[_0xee88('0x36')]=_['intersection'](_0x3aefce[_0xee88('0x33')],qs['fields'](_0x20d3b9[_0xee88('0x34')][_0xee88('0x37')]));_0x109db6[_0xee88('0x36')]=_0x109db6[_0xee88('0x36')][_0xee88('0x4c')]?_0x109db6['attributes']:_0x3aefce[_0xee88('0x33')];_0x109db6[_0xee88('0x3a')]=qs[_0xee88('0x3b')](_0x20d3b9['query'][_0xee88('0x3b')]);_0x109db6[_0xee88('0x3c')]=qs[_0xee88('0x3d')](_['pick'](_0x20d3b9[_0xee88('0x34')],_0x3aefce['filters']));if(_0x20d3b9[_0xee88('0x34')][_0xee88('0x42')]){_0x109db6['where']=_['merge'](_0x109db6['where'],{'$or':_['map'](_0x109db6[_0xee88('0x36')],function(_0x18d1c9){var _0x277448={};_0x277448[_0x18d1c9]={'$like':'%'+_0x20d3b9[_0xee88('0x34')]['filter']+'%'};return _0x277448;})});}_0x109db6=_[_0xee88('0x3f')]({},_0x109db6,_0x20d3b9['options']);return _0x13ebfc[_0xee88('0x50')](_0x109db6);}})['then'](function(_0x544c9b){if(_0x544c9b){_0x3c3445=_0x544c9b['length'];if(!_0x20d3b9['query']['hasOwnProperty'](_0xee88('0x39'))){_0x109db6[_0xee88('0x1f')]=qs[_0xee88('0x1f')](_0x20d3b9[_0xee88('0x34')][_0xee88('0x1f')]);_0x109db6[_0xee88('0x21')]=qs[_0xee88('0x21')](_0x20d3b9[_0xee88('0x34')][_0xee88('0x21')]);}return _0x13ebfc[_0xee88('0x50')](_0x109db6);}})[_0xee88('0x27')](function(_0x49eaf4){if(_0x49eaf4){return _0x49eaf4?{'count':_0x3c3445,'rows':_0x49eaf4}:null;}})[_0xee88('0x27')](respondWithResult(_0x2ba41b,null))[_0xee88('0x48')](handleError(_0x2ba41b,null));};exports[_0xee88('0x52')]=function(_0x11db1c,_0x4909da,_0x4354ee){var _0x4d3f1e={};var _0x12d77e={};var _0x595226;var _0x1af510;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x11db1c[_0xee88('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4909da,null))[_0xee88('0x27')](function(_0x4208e7){if(_0x4208e7){_0x595226=_0x4208e7;_0x12d77e[_0xee88('0x33')]=_[_0xee88('0x4b')](db[_0xee88('0x51')][_0xee88('0x30')]);_0x12d77e[_0xee88('0x34')]=_[_0xee88('0x4b')](_0x11db1c[_0xee88('0x34')]);_0x12d77e[_0xee88('0x3d')]=_['intersection'](_0x12d77e[_0xee88('0x33')],_0x12d77e[_0xee88('0x34')]);_0x4d3f1e[_0xee88('0x36')]=_[_0xee88('0x35')](_0x12d77e[_0xee88('0x33')],qs[_0xee88('0x37')](_0x11db1c['query'][_0xee88('0x37')]));_0x4d3f1e[_0xee88('0x36')]=_0x4d3f1e[_0xee88('0x36')]['length']?_0x4d3f1e['attributes']:_0x12d77e['model'];_0x4d3f1e['order']=qs[_0xee88('0x3b')](_0x11db1c[_0xee88('0x34')]['sort']);_0x4d3f1e[_0xee88('0x3c')]=qs[_0xee88('0x3d')](_['pick'](_0x11db1c['query'],_0x12d77e[_0xee88('0x3d')]));if(_0x11db1c[_0xee88('0x34')][_0xee88('0x42')]){_0x4d3f1e[_0xee88('0x3c')]=_[_0xee88('0x3f')](_0x4d3f1e[_0xee88('0x3c')],{'$or':_[_0xee88('0x2e')](_0x4d3f1e[_0xee88('0x36')],function(_0x48980c){var _0x91ef79={};_0x91ef79[_0x48980c]={'$like':'%'+_0x11db1c['query']['filter']+'%'};return _0x91ef79;})});}_0x4d3f1e=_[_0xee88('0x3f')]({},_0x4d3f1e,_0x11db1c[_0xee88('0x43')]);return _0x595226['getSubjects'](_0x4d3f1e);}})['then'](function(_0x4310f0){if(_0x4310f0){_0x1af510=_0x4310f0[_0xee88('0x4c')];if(!_0x11db1c[_0xee88('0x34')]['hasOwnProperty']('nolimit')){_0x4d3f1e['limit']=qs[_0xee88('0x1f')](_0x11db1c['query'][_0xee88('0x1f')]);_0x4d3f1e[_0xee88('0x21')]=qs[_0xee88('0x21')](_0x11db1c[_0xee88('0x34')]['offset']);}return _0x595226[_0xee88('0x52')](_0x4d3f1e);}})['then'](function(_0x403556){if(_0x403556){return _0x403556?{'count':_0x1af510,'rows':_0x403556}:null;}})[_0xee88('0x27')](respondWithResult(_0x4909da,null))[_0xee88('0x48')](handleError(_0x4909da,null));};exports['getDescriptions']=function(_0x500651,_0x2a5b55,_0x5eff7a){var _0x819e8a={};var _0x53d448={};var _0x51e031;var _0x3bce86;return db[_0xee88('0x2f')][_0xee88('0x53')]({'where':{'id':_0x500651[_0xee88('0x4a')]['id']}})[_0xee88('0x27')](handleEntityNotFound(_0x2a5b55,null))['then'](function(_0x509058){if(_0x509058){_0x51e031=_0x509058;_0x53d448['model']=_['keys'](db['VtigerField'][_0xee88('0x30')]);_0x53d448[_0xee88('0x34')]=_[_0xee88('0x4b')](_0x500651[_0xee88('0x34')]);_0x53d448[_0xee88('0x3d')]=_['intersection'](_0x53d448['model'],_0x53d448[_0xee88('0x34')]);_0x819e8a[_0xee88('0x36')]=_['intersection'](_0x53d448['model'],qs[_0xee88('0x37')](_0x500651[_0xee88('0x34')][_0xee88('0x37')]));_0x819e8a[_0xee88('0x36')]=_0x819e8a[_0xee88('0x36')]['length']?_0x819e8a[_0xee88('0x36')]:_0x53d448[_0xee88('0x33')];_0x819e8a[_0xee88('0x3a')]=qs[_0xee88('0x3b')](_0x500651[_0xee88('0x34')]['sort']);_0x819e8a[_0xee88('0x3c')]=qs['filters'](_[_0xee88('0x3e')](_0x500651[_0xee88('0x34')],_0x53d448[_0xee88('0x3d')]));if(_0x500651['query'][_0xee88('0x42')]){_0x819e8a['where']=_[_0xee88('0x3f')](_0x819e8a['where'],{'$or':_['map'](_0x819e8a[_0xee88('0x36')],function(_0x16da97){var _0x340d63={};_0x340d63[_0x16da97]={'$like':'%'+_0x500651[_0xee88('0x34')][_0xee88('0x42')]+'%'};return _0x340d63;})});}_0x819e8a=_['merge']({},_0x819e8a,_0x500651[_0xee88('0x43')]);return _0x51e031[_0xee88('0x54')](_0x819e8a);}})[_0xee88('0x27')](function(_0x10c44f){if(_0x10c44f){_0x3bce86=_0x10c44f['length'];if(!_0x500651['query'][_0xee88('0x38')]('nolimit')){_0x819e8a[_0xee88('0x1f')]=qs[_0xee88('0x1f')](_0x500651[_0xee88('0x34')][_0xee88('0x1f')]);_0x819e8a[_0xee88('0x21')]=qs[_0xee88('0x21')](_0x500651[_0xee88('0x34')][_0xee88('0x21')]);}return _0x51e031[_0xee88('0x54')](_0x819e8a);}})[_0xee88('0x27')](function(_0x5a175f){if(_0x5a175f){return _0x5a175f?{'count':_0x3bce86,'rows':_0x5a175f}:null;}})[_0xee88('0x27')](respondWithResult(_0x2a5b55,null))['catch'](handleError(_0x2a5b55,null));};
\ No newline at end of file
+var _0xf364=['catch','params','keys','rawAttributes','length','includeAll','find','body','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','sendStatus','name','send','index','VtigerConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','include','rows'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0xf364,0x194));var _0x4f36=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xf364[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x4f36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f36('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f36('0x2'));var moment=require(_0x4f36('0x3'));var BPromise=require(_0x4f36('0x4'));var Mustache=require(_0x4f36('0x5'));var util=require(_0x4f36('0x6'));var path=require(_0x4f36('0x7'));var sox=require(_0x4f36('0x8'));var csv=require(_0x4f36('0x9'));var ejs=require(_0x4f36('0xa'));var fs=require('fs');var fs_extra=require(_0x4f36('0xb'));var _=require('lodash');var squel=require(_0x4f36('0xc'));var crypto=require(_0x4f36('0xd'));var jsforce=require(_0x4f36('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f36('0x9'));var querystring=require(_0x4f36('0xf'));var Papa=require(_0x4f36('0x10'));var Redis=require(_0x4f36('0x11'));var authService=require(_0x4f36('0x12'));var qs=require(_0x4f36('0x13'));var as=require(_0x4f36('0x14'));var hardwareService=require(_0x4f36('0x15'));var logger=require(_0x4f36('0x16'))(_0x4f36('0x17'));var utils=require(_0x4f36('0x18'));var config=require(_0x4f36('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597b0,_0x3c4990){_0x3c4990=_0x3c4990||0xcc;return function(_0x45bc73){if(_0x45bc73){return _0x597b0['sendStatus'](_0x3c4990);}return _0x597b0[_0x4f36('0x1a')](_0x3c4990)[_0x4f36('0x1b')]();};}function respondWithResult(_0x133cc1,_0x3f3638){_0x3f3638=_0x3f3638||0xc8;return function(_0x54fdfe){if(_0x54fdfe){return _0x133cc1['status'](_0x3f3638)['json'](_0x54fdfe);}};}function respondWithFilteredResult(_0x4c4dfe,_0x16dd5f){return function(_0x35b723){if(_0x35b723){var _0x45b5b2=typeof _0x16dd5f[_0x4f36('0x1c')]===_0x4f36('0x1d')&&typeof _0x16dd5f[_0x4f36('0x1e')]===_0x4f36('0x1d');var _0x1218f8=_0x35b723[_0x4f36('0x1f')];var _0x27a4e4=_0x45b5b2?0x0:_0x16dd5f[_0x4f36('0x1c')];var _0x4d759b=_0x45b5b2?_0x35b723[_0x4f36('0x1f')]:_0x16dd5f[_0x4f36('0x1c')]+_0x16dd5f['limit'];var _0x44a0e6;if(_0x4d759b>=_0x1218f8){_0x4d759b=_0x1218f8;_0x44a0e6=0xc8;}else{_0x44a0e6=0xce;}_0x4c4dfe['status'](_0x44a0e6);return _0x4c4dfe[_0x4f36('0x20')](_0x4f36('0x21'),_0x27a4e4+'-'+_0x4d759b+'/'+_0x1218f8)[_0x4f36('0x22')](_0x35b723);}return null;};}function patchUpdates(_0x1e7dac){return function(_0x2f1e9a){try{jsonpatch['apply'](_0x2f1e9a,_0x1e7dac,!![]);}catch(_0x3573b6){return BPromise['reject'](_0x3573b6);}return _0x2f1e9a[_0x4f36('0x23')]();};}function saveUpdates(_0x10a3fa,_0x445d0d){return function(_0x191540){if(_0x191540){return _0x191540[_0x4f36('0x24')](_0x10a3fa)[_0x4f36('0x25')](function(_0x4480d3){return _0x4480d3;});}return null;};}function removeEntity(_0x2be18f,_0x1534ad){return function(_0x2c3c6c){if(_0x2c3c6c){return _0x2c3c6c[_0x4f36('0x26')]()['then'](function(){_0x2be18f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3385,_0x13edc5){return function(_0x1efc0c){if(!_0x1efc0c){_0x5b3385[_0x4f36('0x27')](0x194);}return _0x1efc0c;};}function handleError(_0xe958bc,_0x548d7c){_0x548d7c=_0x548d7c||0x1f4;return function(_0x2d84a8){logger['error'](_0x2d84a8['stack']);if(_0x2d84a8[_0x4f36('0x28')]){delete _0x2d84a8['name'];}_0xe958bc[_0x4f36('0x1a')](_0x548d7c)[_0x4f36('0x29')](_0x2d84a8);};}exports[_0x4f36('0x2a')]=function(_0x6b5fd2,_0x59fd98){var _0x456ced={},_0xc060e2={},_0x12c86f={'count':0x0,'rows':[]};var _0x592edd=_['map'](db[_0x4f36('0x2b')]['rawAttributes'],function(_0x1552d2){return{'name':_0x1552d2[_0x4f36('0x2c')],'type':_0x1552d2[_0x4f36('0x2d')][_0x4f36('0x2e')]};});_0xc060e2[_0x4f36('0x2f')]=_[_0x4f36('0x30')](_0x592edd,_0x4f36('0x28'));_0xc060e2[_0x4f36('0x31')]=_['keys'](_0x6b5fd2[_0x4f36('0x31')]);_0xc060e2[_0x4f36('0x32')]=_[_0x4f36('0x33')](_0xc060e2[_0x4f36('0x2f')],_0xc060e2[_0x4f36('0x31')]);_0x456ced[_0x4f36('0x34')]=_[_0x4f36('0x33')](_0xc060e2[_0x4f36('0x2f')],qs['fields'](_0x6b5fd2[_0x4f36('0x31')][_0x4f36('0x35')]));_0x456ced['attributes']=_0x456ced[_0x4f36('0x34')]['length']?_0x456ced['attributes']:_0xc060e2[_0x4f36('0x2f')];if(!_0x6b5fd2[_0x4f36('0x31')]['hasOwnProperty'](_0x4f36('0x36'))){_0x456ced[_0x4f36('0x1e')]=qs[_0x4f36('0x1e')](_0x6b5fd2[_0x4f36('0x31')][_0x4f36('0x1e')]);_0x456ced[_0x4f36('0x1c')]=qs[_0x4f36('0x1c')](_0x6b5fd2[_0x4f36('0x31')]['offset']);}_0x456ced[_0x4f36('0x37')]=qs[_0x4f36('0x38')](_0x6b5fd2[_0x4f36('0x31')][_0x4f36('0x38')]);_0x456ced[_0x4f36('0x39')]=qs[_0x4f36('0x32')](_[_0x4f36('0x3a')](_0x6b5fd2[_0x4f36('0x31')],_0xc060e2['filters']),_0x592edd);if(_0x6b5fd2['query'][_0x4f36('0x3b')]){_0x456ced[_0x4f36('0x39')]=_[_0x4f36('0x3c')](_0x456ced['where'],{'$or':_['map'](_0x592edd,function(_0x2352cb){if(_0x2352cb['type']!=='VIRTUAL'){var _0x24fd88={};_0x24fd88[_0x2352cb[_0x4f36('0x28')]]={'$like':'%'+_0x6b5fd2[_0x4f36('0x31')][_0x4f36('0x3b')]+'%'};return _0x24fd88;}})});}_0x456ced=_[_0x4f36('0x3c')]({},_0x456ced,_0x6b5fd2[_0x4f36('0x3d')]);var _0x1d1a17={'where':_0x456ced[_0x4f36('0x39')]};return db[_0x4f36('0x2b')][_0x4f36('0x1f')](_0x1d1a17)[_0x4f36('0x25')](function(_0x40abc4){_0x12c86f[_0x4f36('0x1f')]=_0x40abc4;if(_0x6b5fd2['query']['includeAll']){_0x456ced[_0x4f36('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x456ced);})[_0x4f36('0x25')](function(_0x1224af){_0x12c86f[_0x4f36('0x3f')]=_0x1224af;return _0x12c86f;})[_0x4f36('0x25')](respondWithFilteredResult(_0x59fd98,_0x456ced))[_0x4f36('0x40')](handleError(_0x59fd98,null));};exports['show']=function(_0x37586f,_0x5d33ae){var _0x5351bc={'raw':![],'where':{'id':_0x37586f[_0x4f36('0x41')]['id']}},_0x35ba28={};_0x35ba28[_0x4f36('0x2f')]=_[_0x4f36('0x42')](db['VtigerConfiguration'][_0x4f36('0x43')]);_0x35ba28['query']=_[_0x4f36('0x42')](_0x37586f[_0x4f36('0x31')]);_0x35ba28['filters']=_[_0x4f36('0x33')](_0x35ba28[_0x4f36('0x2f')],_0x35ba28[_0x4f36('0x31')]);_0x5351bc[_0x4f36('0x34')]=_[_0x4f36('0x33')](_0x35ba28[_0x4f36('0x2f')],qs['fields'](_0x37586f[_0x4f36('0x31')][_0x4f36('0x35')]));_0x5351bc['attributes']=_0x5351bc[_0x4f36('0x34')][_0x4f36('0x44')]?_0x5351bc[_0x4f36('0x34')]:_0x35ba28[_0x4f36('0x2f')];if(_0x37586f[_0x4f36('0x31')][_0x4f36('0x45')]){_0x5351bc[_0x4f36('0x3e')]=[{'all':!![]}];}_0x5351bc=_[_0x4f36('0x3c')]({},_0x5351bc,_0x37586f['options']);return db['VtigerConfiguration'][_0x4f36('0x46')](_0x5351bc)[_0x4f36('0x25')](handleEntityNotFound(_0x5d33ae,null))[_0x4f36('0x25')](respondWithResult(_0x5d33ae,null))[_0x4f36('0x40')](handleError(_0x5d33ae,null));};exports['create']=function(_0x3a9cac,_0x223055){return db['VtigerConfiguration']['create'](_0x3a9cac[_0x4f36('0x47')],{})[_0x4f36('0x25')](respondWithResult(_0x223055,0xc9))[_0x4f36('0x40')](handleError(_0x223055,null));};exports[_0x4f36('0x24')]=function(_0x58ff54,_0x3ecf86){if(_0x58ff54[_0x4f36('0x47')]['id']){delete _0x58ff54['body']['id'];}return db[_0x4f36('0x2b')][_0x4f36('0x46')]({'where':{'id':_0x58ff54[_0x4f36('0x41')]['id']}})[_0x4f36('0x25')](handleEntityNotFound(_0x3ecf86,null))[_0x4f36('0x25')](saveUpdates(_0x58ff54[_0x4f36('0x47')],null))['then'](respondWithResult(_0x3ecf86,null))[_0x4f36('0x40')](handleError(_0x3ecf86,null));};exports[_0x4f36('0x26')]=function(_0x17899b,_0x3b7347){return db[_0x4f36('0x2b')][_0x4f36('0x46')]({'where':{'id':_0x17899b['params']['id']}})[_0x4f36('0x25')](handleEntityNotFound(_0x3b7347,null))[_0x4f36('0x25')](removeEntity(_0x3b7347,null))[_0x4f36('0x40')](handleError(_0x3b7347,null));};exports[_0x4f36('0x48')]=function(_0x523f64,_0x54dca6,_0x3e37f8){var _0x267b06={};var _0x1a7417={};var _0xa07cc0;var _0xa3bc25;return db[_0x4f36('0x2b')][_0x4f36('0x49')]({'where':{'id':_0x523f64['params']['id']}})[_0x4f36('0x25')](handleEntityNotFound(_0x54dca6,null))[_0x4f36('0x25')](function(_0x6baf9f){if(_0x6baf9f){_0xa07cc0=_0x6baf9f;_0x1a7417[_0x4f36('0x2f')]=_[_0x4f36('0x42')](db[_0x4f36('0x4a')][_0x4f36('0x43')]);_0x1a7417[_0x4f36('0x31')]=_[_0x4f36('0x42')](_0x523f64[_0x4f36('0x31')]);_0x1a7417[_0x4f36('0x32')]=_[_0x4f36('0x33')](_0x1a7417[_0x4f36('0x2f')],_0x1a7417['query']);_0x267b06[_0x4f36('0x34')]=_[_0x4f36('0x33')](_0x1a7417[_0x4f36('0x2f')],qs['fields'](_0x523f64[_0x4f36('0x31')][_0x4f36('0x35')]));_0x267b06[_0x4f36('0x34')]=_0x267b06[_0x4f36('0x34')]['length']?_0x267b06['attributes']:_0x1a7417[_0x4f36('0x2f')];_0x267b06[_0x4f36('0x37')]=qs[_0x4f36('0x38')](_0x523f64['query'][_0x4f36('0x38')]);_0x267b06[_0x4f36('0x39')]=qs[_0x4f36('0x32')](_['pick'](_0x523f64[_0x4f36('0x31')],_0x1a7417[_0x4f36('0x32')]));if(_0x523f64[_0x4f36('0x31')][_0x4f36('0x3b')]){_0x267b06[_0x4f36('0x39')]=_['merge'](_0x267b06[_0x4f36('0x39')],{'$or':_[_0x4f36('0x30')](_0x267b06['attributes'],function(_0x3abdb4){var _0x400fc2={};_0x400fc2[_0x3abdb4]={'$like':'%'+_0x523f64['query'][_0x4f36('0x3b')]+'%'};return _0x400fc2;})});}_0x267b06=_[_0x4f36('0x3c')]({},_0x267b06,_0x523f64[_0x4f36('0x3d')]);return _0xa07cc0[_0x4f36('0x48')](_0x267b06);}})[_0x4f36('0x25')](function(_0x214410){if(_0x214410){_0xa3bc25=_0x214410['length'];if(!_0x523f64[_0x4f36('0x31')][_0x4f36('0x4b')](_0x4f36('0x36'))){_0x267b06[_0x4f36('0x1e')]=qs[_0x4f36('0x1e')](_0x523f64['query'][_0x4f36('0x1e')]);_0x267b06[_0x4f36('0x1c')]=qs[_0x4f36('0x1c')](_0x523f64[_0x4f36('0x31')][_0x4f36('0x1c')]);}return _0xa07cc0[_0x4f36('0x48')](_0x267b06);}})[_0x4f36('0x25')](function(_0x165b2f){if(_0x165b2f){return _0x165b2f?{'count':_0xa3bc25,'rows':_0x165b2f}:null;}})[_0x4f36('0x25')](respondWithResult(_0x54dca6,null))[_0x4f36('0x40')](handleError(_0x54dca6,null));};exports['getSubjects']=function(_0x13758b,_0x4b7f57,_0x814cc4){var _0x30d4df={};var _0x47e611={};var _0x17d772;var _0x725ea0;return db[_0x4f36('0x2b')][_0x4f36('0x49')]({'where':{'id':_0x13758b[_0x4f36('0x41')]['id']}})[_0x4f36('0x25')](handleEntityNotFound(_0x4b7f57,null))[_0x4f36('0x25')](function(_0x569e4c){if(_0x569e4c){_0x17d772=_0x569e4c;_0x47e611[_0x4f36('0x2f')]=_[_0x4f36('0x42')](db['VtigerField']['rawAttributes']);_0x47e611[_0x4f36('0x31')]=_[_0x4f36('0x42')](_0x13758b[_0x4f36('0x31')]);_0x47e611['filters']=_[_0x4f36('0x33')](_0x47e611[_0x4f36('0x2f')],_0x47e611[_0x4f36('0x31')]);_0x30d4df[_0x4f36('0x34')]=_[_0x4f36('0x33')](_0x47e611[_0x4f36('0x2f')],qs[_0x4f36('0x35')](_0x13758b[_0x4f36('0x31')][_0x4f36('0x35')]));_0x30d4df['attributes']=_0x30d4df[_0x4f36('0x34')]['length']?_0x30d4df[_0x4f36('0x34')]:_0x47e611[_0x4f36('0x2f')];_0x30d4df[_0x4f36('0x37')]=qs[_0x4f36('0x38')](_0x13758b[_0x4f36('0x31')]['sort']);_0x30d4df[_0x4f36('0x39')]=qs[_0x4f36('0x32')](_['pick'](_0x13758b[_0x4f36('0x31')],_0x47e611[_0x4f36('0x32')]));if(_0x13758b[_0x4f36('0x31')]['filter']){_0x30d4df['where']=_[_0x4f36('0x3c')](_0x30d4df[_0x4f36('0x39')],{'$or':_['map'](_0x30d4df[_0x4f36('0x34')],function(_0x1c6b10){var _0x1089d4={};_0x1089d4[_0x1c6b10]={'$like':'%'+_0x13758b[_0x4f36('0x31')][_0x4f36('0x3b')]+'%'};return _0x1089d4;})});}_0x30d4df=_['merge']({},_0x30d4df,_0x13758b[_0x4f36('0x3d')]);return _0x17d772[_0x4f36('0x4c')](_0x30d4df);}})[_0x4f36('0x25')](function(_0x47f166){if(_0x47f166){_0x725ea0=_0x47f166[_0x4f36('0x44')];if(!_0x13758b[_0x4f36('0x31')][_0x4f36('0x4b')](_0x4f36('0x36'))){_0x30d4df[_0x4f36('0x1e')]=qs[_0x4f36('0x1e')](_0x13758b[_0x4f36('0x31')][_0x4f36('0x1e')]);_0x30d4df['offset']=qs[_0x4f36('0x1c')](_0x13758b[_0x4f36('0x31')][_0x4f36('0x1c')]);}return _0x17d772['getSubjects'](_0x30d4df);}})['then'](function(_0x666658){if(_0x666658){return _0x666658?{'count':_0x725ea0,'rows':_0x666658}:null;}})['then'](respondWithResult(_0x4b7f57,null))[_0x4f36('0x40')](handleError(_0x4b7f57,null));};exports[_0x4f36('0x4d')]=function(_0x543a4e,_0x392de7,_0xb78356){var _0x2db9f3={};var _0x440f03={};var _0x492c64;var _0x1def89;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x543a4e[_0x4f36('0x41')]['id']}})[_0x4f36('0x25')](handleEntityNotFound(_0x392de7,null))[_0x4f36('0x25')](function(_0x3f03af){if(_0x3f03af){_0x492c64=_0x3f03af;_0x440f03[_0x4f36('0x2f')]=_['keys'](db[_0x4f36('0x4a')][_0x4f36('0x43')]);_0x440f03[_0x4f36('0x31')]=_[_0x4f36('0x42')](_0x543a4e['query']);_0x440f03[_0x4f36('0x32')]=_[_0x4f36('0x33')](_0x440f03[_0x4f36('0x2f')],_0x440f03[_0x4f36('0x31')]);_0x2db9f3[_0x4f36('0x34')]=_[_0x4f36('0x33')](_0x440f03['model'],qs[_0x4f36('0x35')](_0x543a4e[_0x4f36('0x31')]['fields']));_0x2db9f3[_0x4f36('0x34')]=_0x2db9f3[_0x4f36('0x34')][_0x4f36('0x44')]?_0x2db9f3[_0x4f36('0x34')]:_0x440f03[_0x4f36('0x2f')];_0x2db9f3[_0x4f36('0x37')]=qs[_0x4f36('0x38')](_0x543a4e[_0x4f36('0x31')][_0x4f36('0x38')]);_0x2db9f3['where']=qs[_0x4f36('0x32')](_[_0x4f36('0x3a')](_0x543a4e[_0x4f36('0x31')],_0x440f03[_0x4f36('0x32')]));if(_0x543a4e[_0x4f36('0x31')][_0x4f36('0x3b')]){_0x2db9f3[_0x4f36('0x39')]=_[_0x4f36('0x3c')](_0x2db9f3[_0x4f36('0x39')],{'$or':_[_0x4f36('0x30')](_0x2db9f3[_0x4f36('0x34')],function(_0x18c27b){var _0x199a00={};_0x199a00[_0x18c27b]={'$like':'%'+_0x543a4e[_0x4f36('0x31')][_0x4f36('0x3b')]+'%'};return _0x199a00;})});}_0x2db9f3=_[_0x4f36('0x3c')]({},_0x2db9f3,_0x543a4e[_0x4f36('0x3d')]);return _0x492c64[_0x4f36('0x4d')](_0x2db9f3);}})['then'](function(_0xdff4ae){if(_0xdff4ae){_0x1def89=_0xdff4ae[_0x4f36('0x44')];if(!_0x543a4e[_0x4f36('0x31')][_0x4f36('0x4b')]('nolimit')){_0x2db9f3['limit']=qs[_0x4f36('0x1e')](_0x543a4e[_0x4f36('0x31')]['limit']);_0x2db9f3[_0x4f36('0x1c')]=qs['offset'](_0x543a4e[_0x4f36('0x31')][_0x4f36('0x1c')]);}return _0x492c64[_0x4f36('0x4d')](_0x2db9f3);}})['then'](function(_0x4dfaaf){if(_0x4dfaaf){return _0x4dfaaf?{'count':_0x1def89,'rows':_0x4dfaaf}:null;}})[_0x4f36('0x25')](respondWithResult(_0x392de7,null))['catch'](handleError(_0x392de7,null));};
\ No newline at end of file