Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / api / intVtigerField / intVtigerField.controller.js
index fb33aad..0158eab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9499=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','intersection'];(function(_0x1da06b,_0x274c4b){var _0x370e3b=function(_0x423bd5){while(--_0x423bd5){_0x1da06b['push'](_0x1da06b['shift']());}};_0x370e3b(++_0x274c4b);}(_0x9499,0x1e7));var _0x9949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9499[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x9949('0x0'));var emlformat=require(_0x9949('0x1'));var rimraf=require(_0x9949('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9949('0x3'));var rp=require('request-promise');var moment=require(_0x9949('0x4'));var BPromise=require(_0x9949('0x5'));var Mustache=require(_0x9949('0x6'));var util=require(_0x9949('0x7'));var path=require('path');var sox=require(_0x9949('0x8'));var csv=require(_0x9949('0x9'));var ejs=require(_0x9949('0xa'));var fs=require('fs');var _=require(_0x9949('0xb'));var squel=require(_0x9949('0xc'));var crypto=require(_0x9949('0xd'));var jsforce=require(_0x9949('0xe'));var deskjs=require(_0x9949('0xf'));var toCsv=require(_0x9949('0x9'));var querystring=require(_0x9949('0x10'));var Papa=require('papaparse');var Redis=require(_0x9949('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9949('0x12'));var as=require(_0x9949('0x13'));var hardwareService=require(_0x9949('0x14'));var logger=require('../../config/logger')(_0x9949('0x15'));var utils=require(_0x9949('0x16'));var config=require(_0x9949('0x17'));var db=require(_0x9949('0x18'))['db'];function respondWithStatusCode(_0x29b9bc,_0x26f496){_0x26f496=_0x26f496||0xcc;return function(_0x5a4098){if(_0x5a4098){return _0x29b9bc['sendStatus'](_0x26f496);}return _0x29b9bc[_0x9949('0x19')](_0x26f496)[_0x9949('0x1a')]();};}function respondWithResult(_0x3156f6,_0xed6a0f){_0xed6a0f=_0xed6a0f||0xc8;return function(_0x53f263){if(_0x53f263){return _0x3156f6[_0x9949('0x19')](_0xed6a0f)[_0x9949('0x1b')](_0x53f263);}};}function respondWithFilteredResult(_0x13cac6,_0x14c617){return function(_0x387f26){if(_0x387f26){var _0x11a6fb=_0x387f26[_0x9949('0x1c')],_0x3e304a=_0x14c617[_0x9949('0x1d')],_0xa3f67e=_0x14c617[_0x9949('0x1d')]+_0x14c617['limit'],_0x573b29;if(_0xa3f67e>=_0x11a6fb){_0xa3f67e=_0x11a6fb;_0x573b29=0xc8;}else{_0x573b29=0xce;}_0x13cac6[_0x9949('0x19')](_0x573b29);return _0x13cac6[_0x9949('0x1e')](_0x9949('0x1f'),_0x3e304a+'-'+_0xa3f67e+'/'+_0x11a6fb)[_0x9949('0x1b')](_0x387f26);}return null;};}function patchUpdates(_0x1b6208){return function(_0x1e94bd){try{jsonpatch[_0x9949('0x20')](_0x1e94bd,_0x1b6208,!![]);}catch(_0x1fadf8){return BPromise[_0x9949('0x21')](_0x1fadf8);}return _0x1e94bd[_0x9949('0x22')]();};}function saveUpdates(_0x3b53fc,_0x385bd0){return function(_0x258ae9){if(_0x258ae9){return _0x258ae9[_0x9949('0x23')](_0x3b53fc)[_0x9949('0x24')](function(_0x16a98f){return _0x16a98f;});}return null;};}function removeEntity(_0x40e95f,_0x8c3ce3){return function(_0x55145c){if(_0x55145c){return _0x55145c[_0x9949('0x25')]()[_0x9949('0x24')](function(){_0x40e95f[_0x9949('0x19')](0xcc)[_0x9949('0x1a')]();});}};}function handleEntityNotFound(_0x5ebde0,_0x343e83){return function(_0x4fa840){if(!_0x4fa840){_0x5ebde0[_0x9949('0x26')](0x194);}return _0x4fa840;};}function handleError(_0x4852fb,_0x8ee2b0){_0x8ee2b0=_0x8ee2b0||0x1f4;return function(_0x1d2f66){logger[_0x9949('0x27')](_0x1d2f66['stack']);if(_0x1d2f66[_0x9949('0x28')]){delete _0x1d2f66[_0x9949('0x28')];}_0x4852fb[_0x9949('0x19')](_0x8ee2b0)[_0x9949('0x29')](_0x1d2f66);};}exports[_0x9949('0x2a')]=function(_0x588d87,_0xd3c324){var _0xbc68fc={},_0x18a41a={},_0x5a610d={'count':0x0,'rows':[]};var _0x5a57c2=_[_0x9949('0x2b')](db[_0x9949('0x2c')][_0x9949('0x2d')],function(_0x194adf){return{'name':_0x194adf[_0x9949('0x2e')],'type':_0x194adf[_0x9949('0x2f')][_0x9949('0x30')]};});_0x18a41a['model']=_[_0x9949('0x2b')](_0x5a57c2,'name');_0x18a41a[_0x9949('0x31')]=_[_0x9949('0x32')](_0x588d87['query']);_0x18a41a['filters']=_[_0x9949('0x33')](_0x18a41a[_0x9949('0x34')],_0x18a41a['query']);_0xbc68fc[_0x9949('0x35')]=_[_0x9949('0x33')](_0x18a41a[_0x9949('0x34')],qs[_0x9949('0x36')](_0x588d87[_0x9949('0x31')]['fields']));_0xbc68fc['attributes']=_0xbc68fc['attributes'][_0x9949('0x37')]?_0xbc68fc[_0x9949('0x35')]:_0x18a41a[_0x9949('0x34')];if(!_0x588d87[_0x9949('0x31')][_0x9949('0x38')](_0x9949('0x39'))){_0xbc68fc['limit']=qs[_0x9949('0x3a')](_0x588d87[_0x9949('0x31')]['limit']);_0xbc68fc[_0x9949('0x1d')]=qs[_0x9949('0x1d')](_0x588d87[_0x9949('0x31')][_0x9949('0x1d')]);}_0xbc68fc[_0x9949('0x3b')]=qs[_0x9949('0x3c')](_0x588d87['query'][_0x9949('0x3c')]);_0xbc68fc[_0x9949('0x3d')]=qs['filters'](_[_0x9949('0x3e')](_0x588d87[_0x9949('0x31')],_0x18a41a[_0x9949('0x3f')]));if(_0x588d87['query'][_0x9949('0x40')]){_0xbc68fc[_0x9949('0x3d')]=_[_0x9949('0x41')](_0xbc68fc['where'],{'$or':_[_0x9949('0x2b')](_0x5a57c2,function(_0x150948){if(_0x150948[_0x9949('0x2f')]!==_0x9949('0x42')){var _0x1f94d6={};_0x1f94d6[_0x150948[_0x9949('0x28')]]={'$like':'%'+_0x588d87[_0x9949('0x31')][_0x9949('0x40')]+'%'};return _0x1f94d6;}})});}_0xbc68fc=_[_0x9949('0x41')]({},_0xbc68fc,_0x588d87['options']);var _0x10cc7f={'where':_0xbc68fc[_0x9949('0x3d')]};return db[_0x9949('0x2c')][_0x9949('0x1c')](_0x10cc7f)[_0x9949('0x24')](function(_0x27d199){_0x5a610d[_0x9949('0x1c')]=_0x27d199;if(_0x588d87[_0x9949('0x31')][_0x9949('0x43')]){_0xbc68fc[_0x9949('0x44')]=[{'all':!![]}];}return db[_0x9949('0x2c')][_0x9949('0x45')](_0xbc68fc);})[_0x9949('0x24')](function(_0x3b8dfb){_0x5a610d[_0x9949('0x46')]=_0x3b8dfb;return _0x5a610d;})[_0x9949('0x24')](respondWithFilteredResult(_0xd3c324,_0xbc68fc))[_0x9949('0x47')](handleError(_0xd3c324,null));};exports[_0x9949('0x48')]=function(_0x1f1fc0,_0x3c6aad){var _0x63fd4e={'raw':!![],'where':{'id':_0x1f1fc0[_0x9949('0x49')]['id']}},_0x4fbd82={};_0x4fbd82['model']=_[_0x9949('0x32')](db[_0x9949('0x2c')][_0x9949('0x2d')]);_0x4fbd82[_0x9949('0x31')]=_[_0x9949('0x32')](_0x1f1fc0[_0x9949('0x31')]);_0x4fbd82['filters']=_[_0x9949('0x33')](_0x4fbd82['model'],_0x4fbd82[_0x9949('0x31')]);_0x63fd4e[_0x9949('0x35')]=_[_0x9949('0x33')](_0x4fbd82[_0x9949('0x34')],qs[_0x9949('0x36')](_0x1f1fc0[_0x9949('0x31')]['fields']));_0x63fd4e[_0x9949('0x35')]=_0x63fd4e['attributes']['length']?_0x63fd4e[_0x9949('0x35')]:_0x4fbd82['model'];if(_0x1f1fc0[_0x9949('0x31')][_0x9949('0x43')]){_0x63fd4e[_0x9949('0x44')]=[{'all':!![]}];}_0x63fd4e=_[_0x9949('0x41')]({},_0x63fd4e,_0x1f1fc0['options']);return db[_0x9949('0x2c')][_0x9949('0x4a')](_0x63fd4e)['then'](handleEntityNotFound(_0x3c6aad,null))[_0x9949('0x24')](respondWithResult(_0x3c6aad,null))[_0x9949('0x47')](handleError(_0x3c6aad,null));};exports[_0x9949('0x4b')]=function(_0x293709,_0x1a2ae2){return db['VtigerField'][_0x9949('0x4b')](_0x293709[_0x9949('0x4c')],{})['then'](respondWithResult(_0x1a2ae2,0xc9))[_0x9949('0x47')](handleError(_0x1a2ae2,null));};exports['update']=function(_0x560016,_0x4979a2){if(_0x560016['body']['id']){delete _0x560016['body']['id'];}return db['VtigerField'][_0x9949('0x4a')]({'where':{'id':_0x560016[_0x9949('0x49')]['id']}})[_0x9949('0x24')](handleEntityNotFound(_0x4979a2,null))[_0x9949('0x24')](saveUpdates(_0x560016[_0x9949('0x4c')],null))[_0x9949('0x24')](respondWithResult(_0x4979a2,null))[_0x9949('0x47')](handleError(_0x4979a2,null));};exports[_0x9949('0x25')]=function(_0x97ce83,_0x57361e){return db[_0x9949('0x2c')][_0x9949('0x4a')]({'where':{'id':_0x97ce83[_0x9949('0x49')]['id']}})[_0x9949('0x24')](handleEntityNotFound(_0x57361e,null))['then'](removeEntity(_0x57361e,null))['catch'](handleError(_0x57361e,null));};
\ No newline at end of file
+var _0x530f=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','update','body','params','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x26a9e0,_0x1c482a){var _0x2756e4=function(_0x4e9677){while(--_0x4e9677){_0x26a9e0['push'](_0x26a9e0['shift']());}};_0x2756e4(++_0x1c482a);}(_0x530f,0x1ba));var _0xf530=function(_0x3d474e,_0x431f54){_0x3d474e=_0x3d474e-0x0;var _0x30b3e3=_0x530f[_0x3d474e];return _0x30b3e3;};'use strict';var pdf=require(_0xf530('0x0'));var emlformat=require(_0xf530('0x1'));var rimraf=require(_0xf530('0x2'));var zipdir=require(_0xf530('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf530('0x4'));var Mustache=require(_0xf530('0x5'));var util=require('util');var path=require(_0xf530('0x6'));var sox=require(_0xf530('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf530('0x8'));var squel=require(_0xf530('0x9'));var crypto=require(_0xf530('0xa'));var jsforce=require(_0xf530('0xb'));var deskjs=require(_0xf530('0xc'));var toCsv=require(_0xf530('0xd'));var querystring=require(_0xf530('0xe'));var Papa=require(_0xf530('0xf'));var Redis=require(_0xf530('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf530('0x11'));var as=require(_0xf530('0x12'));var hardwareService=require(_0xf530('0x13'));var logger=require('../../config/logger')(_0xf530('0x14'));var utils=require(_0xf530('0x15'));var config=require(_0xf530('0x16'));var db=require(_0xf530('0x17'))['db'];function respondWithStatusCode(_0x44c382,_0x250922){_0x250922=_0x250922||0xcc;return function(_0x138a5f){if(_0x138a5f){return _0x44c382[_0xf530('0x18')](_0x250922);}return _0x44c382[_0xf530('0x19')](_0x250922)['end']();};}function respondWithResult(_0x19992b,_0x32f868){_0x32f868=_0x32f868||0xc8;return function(_0x3b2374){if(_0x3b2374){return _0x19992b[_0xf530('0x19')](_0x32f868)[_0xf530('0x1a')](_0x3b2374);}};}function respondWithFilteredResult(_0x3b8903,_0x148f6c){return function(_0x17f74c){if(_0x17f74c){var _0x5407d3=_0x17f74c[_0xf530('0x1b')],_0x5e6f22=_0x148f6c[_0xf530('0x1c')],_0x323969=_0x148f6c[_0xf530('0x1c')]+_0x148f6c[_0xf530('0x1d')],_0x18f78e;if(_0x323969>=_0x5407d3){_0x323969=_0x5407d3;_0x18f78e=0xc8;}else{_0x18f78e=0xce;}_0x3b8903['status'](_0x18f78e);return _0x3b8903[_0xf530('0x1e')](_0xf530('0x1f'),_0x5e6f22+'-'+_0x323969+'/'+_0x5407d3)['json'](_0x17f74c);}return null;};}function patchUpdates(_0x61c2c1){return function(_0x3f5443){try{jsonpatch[_0xf530('0x20')](_0x3f5443,_0x61c2c1,!![]);}catch(_0x267db5){return BPromise[_0xf530('0x21')](_0x267db5);}return _0x3f5443[_0xf530('0x22')]();};}function saveUpdates(_0x877d8f,_0x23d4ab){return function(_0x2f1bb4){if(_0x2f1bb4){return _0x2f1bb4['update'](_0x877d8f)[_0xf530('0x23')](function(_0x3fb4b4){return _0x3fb4b4;});}return null;};}function removeEntity(_0x9bf990,_0x57d325){return function(_0x384a7f){if(_0x384a7f){return _0x384a7f[_0xf530('0x24')]()[_0xf530('0x23')](function(){_0x9bf990['status'](0xcc)[_0xf530('0x25')]();});}};}function handleEntityNotFound(_0x2e1bb6,_0x2facb4){return function(_0x548307){if(!_0x548307){_0x2e1bb6[_0xf530('0x18')](0x194);}return _0x548307;};}function handleError(_0xe0217c,_0x337c8a){_0x337c8a=_0x337c8a||0x1f4;return function(_0x549151){logger[_0xf530('0x26')](_0x549151[_0xf530('0x27')]);if(_0x549151['name']){delete _0x549151[_0xf530('0x28')];}_0xe0217c['status'](_0x337c8a)[_0xf530('0x29')](_0x549151);};}exports[_0xf530('0x2a')]=function(_0x1bd3ff,_0x5d6966){var _0x1333d4={},_0x110d7f={},_0x40ee05={'count':0x0,'rows':[]};var _0x2a2549=_[_0xf530('0x2b')](db['VtigerField']['rawAttributes'],function(_0x2d4dea){return{'name':_0x2d4dea['fieldName'],'type':_0x2d4dea['type'][_0xf530('0x2c')]};});_0x110d7f['model']=_[_0xf530('0x2b')](_0x2a2549,_0xf530('0x28'));_0x110d7f[_0xf530('0x2d')]=_[_0xf530('0x2e')](_0x1bd3ff[_0xf530('0x2d')]);_0x110d7f[_0xf530('0x2f')]=_[_0xf530('0x30')](_0x110d7f[_0xf530('0x31')],_0x110d7f['query']);_0x1333d4[_0xf530('0x32')]=_[_0xf530('0x30')](_0x110d7f[_0xf530('0x31')],qs[_0xf530('0x33')](_0x1bd3ff['query'][_0xf530('0x33')]));_0x1333d4['attributes']=_0x1333d4[_0xf530('0x32')]['length']?_0x1333d4['attributes']:_0x110d7f[_0xf530('0x31')];if(!_0x1bd3ff[_0xf530('0x2d')][_0xf530('0x34')](_0xf530('0x35'))){_0x1333d4[_0xf530('0x1d')]=qs[_0xf530('0x1d')](_0x1bd3ff[_0xf530('0x2d')]['limit']);_0x1333d4[_0xf530('0x1c')]=qs[_0xf530('0x1c')](_0x1bd3ff[_0xf530('0x2d')]['offset']);}_0x1333d4[_0xf530('0x36')]=qs[_0xf530('0x37')](_0x1bd3ff[_0xf530('0x2d')][_0xf530('0x37')]);_0x1333d4[_0xf530('0x38')]=qs[_0xf530('0x2f')](_[_0xf530('0x39')](_0x1bd3ff['query'],_0x110d7f[_0xf530('0x2f')]));if(_0x1bd3ff[_0xf530('0x2d')]['filter']){_0x1333d4[_0xf530('0x38')]=_[_0xf530('0x3a')](_0x1333d4[_0xf530('0x38')],{'$or':_[_0xf530('0x2b')](_0x2a2549,function(_0x582dcd){if(_0x582dcd[_0xf530('0x3b')]!==_0xf530('0x3c')){var _0x2f5a80={};_0x2f5a80[_0x582dcd[_0xf530('0x28')]]={'$like':'%'+_0x1bd3ff['query']['filter']+'%'};return _0x2f5a80;}})});}_0x1333d4=_['merge']({},_0x1333d4,_0x1bd3ff[_0xf530('0x3d')]);var _0x2f0ab7={'where':_0x1333d4[_0xf530('0x38')]};return db[_0xf530('0x3e')][_0xf530('0x1b')](_0x2f0ab7)['then'](function(_0x324fd1){_0x40ee05['count']=_0x324fd1;if(_0x1bd3ff[_0xf530('0x2d')][_0xf530('0x3f')]){_0x1333d4[_0xf530('0x40')]=[{'all':!![]}];}return db[_0xf530('0x3e')][_0xf530('0x41')](_0x1333d4);})[_0xf530('0x23')](function(_0x381b94){_0x40ee05[_0xf530('0x42')]=_0x381b94;return _0x40ee05;})[_0xf530('0x23')](respondWithFilteredResult(_0x5d6966,_0x1333d4))[_0xf530('0x43')](handleError(_0x5d6966,null));};exports[_0xf530('0x44')]=function(_0x5cad1c,_0x5a8629){var _0x5cc031={'raw':!![],'where':{'id':_0x5cad1c['params']['id']}},_0x189b21={};_0x189b21[_0xf530('0x31')]=_[_0xf530('0x2e')](db[_0xf530('0x3e')][_0xf530('0x45')]);_0x189b21[_0xf530('0x2d')]=_[_0xf530('0x2e')](_0x5cad1c[_0xf530('0x2d')]);_0x189b21[_0xf530('0x2f')]=_[_0xf530('0x30')](_0x189b21[_0xf530('0x31')],_0x189b21['query']);_0x5cc031[_0xf530('0x32')]=_[_0xf530('0x30')](_0x189b21['model'],qs[_0xf530('0x33')](_0x5cad1c['query'][_0xf530('0x33')]));_0x5cc031[_0xf530('0x32')]=_0x5cc031[_0xf530('0x32')][_0xf530('0x46')]?_0x5cc031[_0xf530('0x32')]:_0x189b21[_0xf530('0x31')];if(_0x5cad1c[_0xf530('0x2d')][_0xf530('0x3f')]){_0x5cc031[_0xf530('0x40')]=[{'all':!![]}];}_0x5cc031=_[_0xf530('0x3a')]({},_0x5cc031,_0x5cad1c[_0xf530('0x3d')]);return db[_0xf530('0x3e')][_0xf530('0x47')](_0x5cc031)['then'](handleEntityNotFound(_0x5a8629,null))[_0xf530('0x23')](respondWithResult(_0x5a8629,null))['catch'](handleError(_0x5a8629,null));};exports['create']=function(_0xb27f35,_0x467387){return db[_0xf530('0x3e')][_0xf530('0x48')](_0xb27f35['body'],{})['then'](respondWithResult(_0x467387,0xc9))[_0xf530('0x43')](handleError(_0x467387,null));};exports[_0xf530('0x49')]=function(_0x266acc,_0x5c4adf){if(_0x266acc[_0xf530('0x4a')]['id']){delete _0x266acc['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x266acc[_0xf530('0x4b')]['id']}})[_0xf530('0x23')](handleEntityNotFound(_0x5c4adf,null))[_0xf530('0x23')](saveUpdates(_0x266acc[_0xf530('0x4a')],null))['then'](respondWithResult(_0x5c4adf,null))['catch'](handleError(_0x5c4adf,null));};exports['destroy']=function(_0x462ba8,_0x25c8af){return db[_0xf530('0x3e')]['find']({'where':{'id':_0x462ba8[_0xf530('0x4b')]['id']}})[_0xf530('0x23')](handleEntityNotFound(_0x25c8af,null))[_0xf530('0x23')](removeEntity(_0x25c8af,null))[_0xf530('0x43')](handleError(_0x25c8af,null));};
\ No newline at end of file