Built motion from commit (unavailable).|2.4.20
[motion2.git] / server / api / intZohoField / intZohoField.controller.js
index d795d94..250b0d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50d0=['query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','then','end','error','stack','name','send','ZohoField','rawAttributes','fieldName','type','key','map'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x50d0,0x1dd));var _0x050d=function(_0x1f6552,_0x3bffd6){_0x1f6552=_0x1f6552-0x0;var _0x239def=_0x50d0[_0x1f6552];return _0x239def;};'use strict';var pdf=require(_0x050d('0x0'));var emlformat=require(_0x050d('0x1'));var rimraf=require(_0x050d('0x2'));var zipdir=require(_0x050d('0x3'));var jsonpatch=require(_0x050d('0x4'));var rp=require(_0x050d('0x5'));var moment=require('moment');var BPromise=require(_0x050d('0x6'));var Mustache=require(_0x050d('0x7'));var util=require('util');var path=require('path');var sox=require(_0x050d('0x8'));var csv=require(_0x050d('0x9'));var ejs=require(_0x050d('0xa'));var fs=require('fs');var _=require(_0x050d('0xb'));var squel=require(_0x050d('0xc'));var crypto=require('crypto');var jsforce=require(_0x050d('0xd'));var deskjs=require(_0x050d('0xe'));var toCsv=require(_0x050d('0x9'));var querystring=require(_0x050d('0xf'));var Papa=require(_0x050d('0x10'));var Redis=require(_0x050d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x050d('0x12'));var as=require(_0x050d('0x13'));var hardwareService=require(_0x050d('0x14'));var logger=require(_0x050d('0x15'))(_0x050d('0x16'));var utils=require(_0x050d('0x17'));var config=require(_0x050d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x470f8e,_0x577f9d){_0x577f9d=_0x577f9d||0xcc;return function(_0x1b5f47){if(_0x1b5f47){return _0x470f8e[_0x050d('0x19')](_0x577f9d);}return _0x470f8e[_0x050d('0x1a')](_0x577f9d)['end']();};}function respondWithResult(_0x5f2349,_0x34cfc0){_0x34cfc0=_0x34cfc0||0xc8;return function(_0xa4d2f8){if(_0xa4d2f8){return _0x5f2349['status'](_0x34cfc0)[_0x050d('0x1b')](_0xa4d2f8);}};}function respondWithFilteredResult(_0x5ce0dc,_0x3eb6dc){return function(_0x51f5fd){if(_0x51f5fd){var _0x1775ab=_0x51f5fd[_0x050d('0x1c')],_0xc0471d=_0x3eb6dc[_0x050d('0x1d')],_0x1f6bc9=_0x3eb6dc[_0x050d('0x1d')]+_0x3eb6dc[_0x050d('0x1e')],_0x25cf06;if(_0x1f6bc9>=_0x1775ab){_0x1f6bc9=_0x1775ab;_0x25cf06=0xc8;}else{_0x25cf06=0xce;}_0x5ce0dc[_0x050d('0x1a')](_0x25cf06);return _0x5ce0dc[_0x050d('0x1f')]('Content-Range',_0xc0471d+'-'+_0x1f6bc9+'/'+_0x1775ab)['json'](_0x51f5fd);}return null;};}function patchUpdates(_0x59a62f){return function(_0x4c34aa){try{jsonpatch[_0x050d('0x20')](_0x4c34aa,_0x59a62f,!![]);}catch(_0x5bcb17){return BPromise[_0x050d('0x21')](_0x5bcb17);}return _0x4c34aa['save']();};}function saveUpdates(_0x4037df,_0x40e3be){return function(_0x465cc3){if(_0x465cc3){return _0x465cc3[_0x050d('0x22')](_0x4037df)['then'](function(_0x4401ac){return _0x4401ac;});}return null;};}function removeEntity(_0x1919d5,_0x2d526e){return function(_0x5e60af){if(_0x5e60af){return _0x5e60af[_0x050d('0x23')]()[_0x050d('0x24')](function(){_0x1919d5[_0x050d('0x1a')](0xcc)[_0x050d('0x25')]();});}};}function handleEntityNotFound(_0x2db6d9,_0x25cce5){return function(_0xc47f35){if(!_0xc47f35){_0x2db6d9['sendStatus'](0x194);}return _0xc47f35;};}function handleError(_0x23c92d,_0x4f439f){_0x4f439f=_0x4f439f||0x1f4;return function(_0x2007d8){logger[_0x050d('0x26')](_0x2007d8[_0x050d('0x27')]);if(_0x2007d8[_0x050d('0x28')]){delete _0x2007d8['name'];}_0x23c92d[_0x050d('0x1a')](_0x4f439f)[_0x050d('0x29')](_0x2007d8);};}exports['index']=function(_0x377c45,_0x3b5c77){var _0x52481f={},_0x22cbbb={},_0x3038ae={'count':0x0,'rows':[]};var _0x44c9bc=_['map'](db[_0x050d('0x2a')][_0x050d('0x2b')],function(_0x151378){return{'name':_0x151378[_0x050d('0x2c')],'type':_0x151378[_0x050d('0x2d')][_0x050d('0x2e')]};});_0x22cbbb['model']=_[_0x050d('0x2f')](_0x44c9bc,_0x050d('0x28'));_0x22cbbb[_0x050d('0x30')]=_['keys'](_0x377c45[_0x050d('0x30')]);_0x22cbbb[_0x050d('0x31')]=_[_0x050d('0x32')](_0x22cbbb[_0x050d('0x33')],_0x22cbbb[_0x050d('0x30')]);_0x52481f['attributes']=_[_0x050d('0x32')](_0x22cbbb[_0x050d('0x33')],qs[_0x050d('0x34')](_0x377c45[_0x050d('0x30')][_0x050d('0x34')]));_0x52481f['attributes']=_0x52481f[_0x050d('0x35')]['length']?_0x52481f[_0x050d('0x35')]:_0x22cbbb[_0x050d('0x33')];if(!_0x377c45[_0x050d('0x30')][_0x050d('0x36')](_0x050d('0x37'))){_0x52481f['limit']=qs[_0x050d('0x1e')](_0x377c45[_0x050d('0x30')][_0x050d('0x1e')]);_0x52481f['offset']=qs[_0x050d('0x1d')](_0x377c45['query'][_0x050d('0x1d')]);}_0x52481f[_0x050d('0x38')]=qs[_0x050d('0x39')](_0x377c45[_0x050d('0x30')][_0x050d('0x39')]);_0x52481f[_0x050d('0x3a')]=qs[_0x050d('0x31')](_['pick'](_0x377c45['query'],_0x22cbbb[_0x050d('0x31')]));if(_0x377c45['query'][_0x050d('0x3b')]){_0x52481f['where']=_[_0x050d('0x3c')](_0x52481f['where'],{'$or':_[_0x050d('0x2f')](_0x44c9bc,function(_0x1c30ea){if(_0x1c30ea[_0x050d('0x2d')]!==_0x050d('0x3d')){var _0x4b5e26={};_0x4b5e26[_0x1c30ea[_0x050d('0x28')]]={'$like':'%'+_0x377c45[_0x050d('0x30')]['filter']+'%'};return _0x4b5e26;}})});}_0x52481f=_[_0x050d('0x3c')]({},_0x52481f,_0x377c45[_0x050d('0x3e')]);var _0x2edc55={'where':_0x52481f[_0x050d('0x3a')]};return db[_0x050d('0x2a')][_0x050d('0x1c')](_0x2edc55)[_0x050d('0x24')](function(_0x4d3a1d){_0x3038ae[_0x050d('0x1c')]=_0x4d3a1d;if(_0x377c45[_0x050d('0x30')][_0x050d('0x3f')]){_0x52481f[_0x050d('0x40')]=[{'all':!![]}];}return db[_0x050d('0x2a')][_0x050d('0x41')](_0x52481f);})[_0x050d('0x24')](function(_0x559535){_0x3038ae[_0x050d('0x42')]=_0x559535;return _0x3038ae;})[_0x050d('0x24')](respondWithFilteredResult(_0x3b5c77,_0x52481f))['catch'](handleError(_0x3b5c77,null));};exports[_0x050d('0x43')]=function(_0x384187,_0x1e6057){var _0x787deb={'raw':!![],'where':{'id':_0x384187[_0x050d('0x44')]['id']}},_0x1cab31={};_0x1cab31['model']=_[_0x050d('0x45')](db[_0x050d('0x2a')][_0x050d('0x2b')]);_0x1cab31['query']=_[_0x050d('0x45')](_0x384187['query']);_0x1cab31[_0x050d('0x31')]=_[_0x050d('0x32')](_0x1cab31['model'],_0x1cab31[_0x050d('0x30')]);_0x787deb[_0x050d('0x35')]=_[_0x050d('0x32')](_0x1cab31[_0x050d('0x33')],qs[_0x050d('0x34')](_0x384187[_0x050d('0x30')][_0x050d('0x34')]));_0x787deb[_0x050d('0x35')]=_0x787deb['attributes'][_0x050d('0x46')]?_0x787deb['attributes']:_0x1cab31[_0x050d('0x33')];if(_0x384187[_0x050d('0x30')][_0x050d('0x3f')]){_0x787deb['include']=[{'all':!![]}];}_0x787deb=_['merge']({},_0x787deb,_0x384187[_0x050d('0x3e')]);return db[_0x050d('0x2a')][_0x050d('0x47')](_0x787deb)[_0x050d('0x24')](handleEntityNotFound(_0x1e6057,null))[_0x050d('0x24')](respondWithResult(_0x1e6057,null))[_0x050d('0x48')](handleError(_0x1e6057,null));};exports[_0x050d('0x49')]=function(_0x3fc920,_0x2b3c9d){return db['ZohoField'][_0x050d('0x49')](_0x3fc920[_0x050d('0x4a')],{})[_0x050d('0x24')](respondWithResult(_0x2b3c9d,0xc9))[_0x050d('0x48')](handleError(_0x2b3c9d,null));};exports[_0x050d('0x22')]=function(_0x2db28d,_0x132b8b){if(_0x2db28d[_0x050d('0x4a')]['id']){delete _0x2db28d[_0x050d('0x4a')]['id'];}return db['ZohoField'][_0x050d('0x47')]({'where':{'id':_0x2db28d[_0x050d('0x44')]['id']}})[_0x050d('0x24')](handleEntityNotFound(_0x132b8b,null))[_0x050d('0x24')](saveUpdates(_0x2db28d['body'],null))['then'](respondWithResult(_0x132b8b,null))['catch'](handleError(_0x132b8b,null));};exports[_0x050d('0x23')]=function(_0x1342d9,_0x3074c1){return db['ZohoField']['find']({'where':{'id':_0x1342d9[_0x050d('0x44')]['id']}})[_0x050d('0x24')](handleEntityNotFound(_0x3074c1,null))['then'](removeEntity(_0x3074c1,null))['catch'](handleError(_0x3074c1,null));};
\ No newline at end of file
+var _0x42f6=['then','error','name','send','index','map','ZohoField','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','options','include','rows','show','params','rawAttributes','includeAll','find','create','body','catch','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x42f6,0x151));var _0x642f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x42f6[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x642f('0x0'));var emlformat=require(_0x642f('0x1'));var rimraf=require(_0x642f('0x2'));var zipdir=require(_0x642f('0x3'));var jsonpatch=require(_0x642f('0x4'));var rp=require(_0x642f('0x5'));var moment=require('moment');var BPromise=require(_0x642f('0x6'));var Mustache=require(_0x642f('0x7'));var util=require(_0x642f('0x8'));var path=require(_0x642f('0x9'));var sox=require(_0x642f('0xa'));var csv=require(_0x642f('0xb'));var ejs=require(_0x642f('0xc'));var fs=require('fs');var _=require(_0x642f('0xd'));var squel=require(_0x642f('0xe'));var crypto=require(_0x642f('0xf'));var jsforce=require(_0x642f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x642f('0xb'));var querystring=require(_0x642f('0x11'));var Papa=require(_0x642f('0x12'));var Redis=require('ioredis');var authService=require(_0x642f('0x13'));var qs=require(_0x642f('0x14'));var as=require(_0x642f('0x15'));var hardwareService=require(_0x642f('0x16'));var logger=require(_0x642f('0x17'))('api');var utils=require(_0x642f('0x18'));var config=require(_0x642f('0x19'));var db=require(_0x642f('0x1a'))['db'];function respondWithStatusCode(_0x313a76,_0x274387){_0x274387=_0x274387||0xcc;return function(_0x2574d4){if(_0x2574d4){return _0x313a76[_0x642f('0x1b')](_0x274387);}return _0x313a76['status'](_0x274387)[_0x642f('0x1c')]();};}function respondWithResult(_0x5d7ae4,_0xe2f772){_0xe2f772=_0xe2f772||0xc8;return function(_0x1b4544){if(_0x1b4544){return _0x5d7ae4['status'](_0xe2f772)[_0x642f('0x1d')](_0x1b4544);}};}function respondWithFilteredResult(_0x4c1baa,_0x3de0ab){return function(_0x35113b){if(_0x35113b){var _0x33fb1d=_0x35113b[_0x642f('0x1e')],_0x30e0e7=_0x3de0ab['offset'],_0x725768=_0x3de0ab[_0x642f('0x1f')]+_0x3de0ab[_0x642f('0x20')],_0x49dfe4;if(_0x725768>=_0x33fb1d){_0x725768=_0x33fb1d;_0x49dfe4=0xc8;}else{_0x49dfe4=0xce;}_0x4c1baa[_0x642f('0x21')](_0x49dfe4);return _0x4c1baa[_0x642f('0x22')]('Content-Range',_0x30e0e7+'-'+_0x725768+'/'+_0x33fb1d)[_0x642f('0x1d')](_0x35113b);}return null;};}function patchUpdates(_0x7a28f7){return function(_0x4161c8){try{jsonpatch[_0x642f('0x23')](_0x4161c8,_0x7a28f7,!![]);}catch(_0x51ac3b){return BPromise[_0x642f('0x24')](_0x51ac3b);}return _0x4161c8[_0x642f('0x25')]();};}function saveUpdates(_0x42279c,_0x721348){return function(_0x3ffb1a){if(_0x3ffb1a){return _0x3ffb1a['update'](_0x42279c)[_0x642f('0x26')](function(_0x2b9454){return _0x2b9454;});}return null;};}function removeEntity(_0x39fc30,_0x5c9233){return function(_0x18e898){if(_0x18e898){return _0x18e898['destroy']()[_0x642f('0x26')](function(){_0x39fc30[_0x642f('0x21')](0xcc)[_0x642f('0x1c')]();});}};}function handleEntityNotFound(_0xe581d7,_0x407e5a){return function(_0x883d07){if(!_0x883d07){_0xe581d7[_0x642f('0x1b')](0x194);}return _0x883d07;};}function handleError(_0x4b7ecb,_0x1114af){_0x1114af=_0x1114af||0x1f4;return function(_0x48a29d){logger[_0x642f('0x27')](_0x48a29d['stack']);if(_0x48a29d[_0x642f('0x28')]){delete _0x48a29d['name'];}_0x4b7ecb[_0x642f('0x21')](_0x1114af)[_0x642f('0x29')](_0x48a29d);};}exports[_0x642f('0x2a')]=function(_0x2e13c3,_0x65b75){var _0x3de348={},_0x4b3b86={},_0x161dda={'count':0x0,'rows':[]};var _0x4ce486=_[_0x642f('0x2b')](db[_0x642f('0x2c')]['rawAttributes'],function(_0x18c709){return{'name':_0x18c709['fieldName'],'type':_0x18c709[_0x642f('0x2d')][_0x642f('0x2e')]};});_0x4b3b86[_0x642f('0x2f')]=_[_0x642f('0x2b')](_0x4ce486,_0x642f('0x28'));_0x4b3b86['query']=_[_0x642f('0x30')](_0x2e13c3[_0x642f('0x31')]);_0x4b3b86['filters']=_[_0x642f('0x32')](_0x4b3b86[_0x642f('0x2f')],_0x4b3b86[_0x642f('0x31')]);_0x3de348['attributes']=_['intersection'](_0x4b3b86['model'],qs[_0x642f('0x33')](_0x2e13c3[_0x642f('0x31')][_0x642f('0x33')]));_0x3de348[_0x642f('0x34')]=_0x3de348[_0x642f('0x34')][_0x642f('0x35')]?_0x3de348[_0x642f('0x34')]:_0x4b3b86[_0x642f('0x2f')];if(!_0x2e13c3[_0x642f('0x31')][_0x642f('0x36')](_0x642f('0x37'))){_0x3de348[_0x642f('0x20')]=qs['limit'](_0x2e13c3['query']['limit']);_0x3de348['offset']=qs[_0x642f('0x1f')](_0x2e13c3['query'][_0x642f('0x1f')]);}_0x3de348[_0x642f('0x38')]=qs['sort'](_0x2e13c3[_0x642f('0x31')][_0x642f('0x39')]);_0x3de348['where']=qs['filters'](_['pick'](_0x2e13c3['query'],_0x4b3b86[_0x642f('0x3a')]));if(_0x2e13c3[_0x642f('0x31')]['filter']){_0x3de348[_0x642f('0x3b')]=_[_0x642f('0x3c')](_0x3de348['where'],{'$or':_[_0x642f('0x2b')](_0x4ce486,function(_0x22f352){if(_0x22f352[_0x642f('0x2d')]!==_0x642f('0x3d')){var _0x4dee4e={};_0x4dee4e[_0x22f352['name']]={'$like':'%'+_0x2e13c3[_0x642f('0x31')]['filter']+'%'};return _0x4dee4e;}})});}_0x3de348=_[_0x642f('0x3c')]({},_0x3de348,_0x2e13c3[_0x642f('0x3e')]);var _0x32e71c={'where':_0x3de348[_0x642f('0x3b')]};return db[_0x642f('0x2c')][_0x642f('0x1e')](_0x32e71c)['then'](function(_0x368016){_0x161dda[_0x642f('0x1e')]=_0x368016;if(_0x2e13c3['query']['includeAll']){_0x3de348[_0x642f('0x3f')]=[{'all':!![]}];}return db[_0x642f('0x2c')]['findAll'](_0x3de348);})['then'](function(_0x318f90){_0x161dda[_0x642f('0x40')]=_0x318f90;return _0x161dda;})[_0x642f('0x26')](respondWithFilteredResult(_0x65b75,_0x3de348))['catch'](handleError(_0x65b75,null));};exports[_0x642f('0x41')]=function(_0x5a920e,_0x1dd669){var _0x335fe8={'raw':!![],'where':{'id':_0x5a920e[_0x642f('0x42')]['id']}},_0x101b86={};_0x101b86[_0x642f('0x2f')]=_[_0x642f('0x30')](db[_0x642f('0x2c')][_0x642f('0x43')]);_0x101b86[_0x642f('0x31')]=_['keys'](_0x5a920e[_0x642f('0x31')]);_0x101b86[_0x642f('0x3a')]=_[_0x642f('0x32')](_0x101b86[_0x642f('0x2f')],_0x101b86[_0x642f('0x31')]);_0x335fe8['attributes']=_[_0x642f('0x32')](_0x101b86[_0x642f('0x2f')],qs[_0x642f('0x33')](_0x5a920e[_0x642f('0x31')][_0x642f('0x33')]));_0x335fe8[_0x642f('0x34')]=_0x335fe8[_0x642f('0x34')][_0x642f('0x35')]?_0x335fe8[_0x642f('0x34')]:_0x101b86['model'];if(_0x5a920e['query'][_0x642f('0x44')]){_0x335fe8[_0x642f('0x3f')]=[{'all':!![]}];}_0x335fe8=_[_0x642f('0x3c')]({},_0x335fe8,_0x5a920e['options']);return db['ZohoField'][_0x642f('0x45')](_0x335fe8)['then'](handleEntityNotFound(_0x1dd669,null))[_0x642f('0x26')](respondWithResult(_0x1dd669,null))['catch'](handleError(_0x1dd669,null));};exports[_0x642f('0x46')]=function(_0x39bf67,_0x5013bd){return db['ZohoField'][_0x642f('0x46')](_0x39bf67[_0x642f('0x47')],{})[_0x642f('0x26')](respondWithResult(_0x5013bd,0xc9))[_0x642f('0x48')](handleError(_0x5013bd,null));};exports[_0x642f('0x49')]=function(_0x48801f,_0x5e1c20){if(_0x48801f['body']['id']){delete _0x48801f[_0x642f('0x47')]['id'];}return db[_0x642f('0x2c')][_0x642f('0x45')]({'where':{'id':_0x48801f[_0x642f('0x42')]['id']}})[_0x642f('0x26')](handleEntityNotFound(_0x5e1c20,null))[_0x642f('0x26')](saveUpdates(_0x48801f['body'],null))[_0x642f('0x26')](respondWithResult(_0x5e1c20,null))[_0x642f('0x48')](handleError(_0x5e1c20,null));};exports[_0x642f('0x4a')]=function(_0xbc8cc7,_0x2bd200){return db['ZohoField'][_0x642f('0x45')]({'where':{'id':_0xbc8cc7['params']['id']}})[_0x642f('0x26')](handleEntityNotFound(_0x2bd200,null))[_0x642f('0x26')](removeEntity(_0x2bd200,null))[_0x642f('0x48')](handleError(_0x2bd200,null));};
\ No newline at end of file