Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / intSugarcrmField / intSugarcrmField.controller.js
index 1b21ea5..d03f9de 100644 (file)
@@ -1 +1 @@
-const a316_0x1778=['params','query','offset','fields','status','include','where','show','pick','findOne','send','key','name','VIRTUAL','undefined','catch','sendStatus','type','options','set','index','body','limit','length','lodash','count','sequelize','merge','destroy','keys','rawAttributes','model','end','nolimit','then','order','update','SugarcrmField','like','filter','sort','rows','../../config/logger','../../components/parsers/qs','map','intersection','includeAll','filters','json','attributes'];(function(_0x309ff0,_0x17788c){const _0x29d3ad=function(_0x336c36){while(--_0x336c36){_0x309ff0['push'](_0x309ff0['shift']());}};_0x29d3ad(++_0x17788c);}(a316_0x1778,0x7e));const a316_0x29d3=function(_0x309ff0,_0x17788c){_0x309ff0=_0x309ff0-0x0;let _0x29d3ad=a316_0x1778[_0x309ff0];return _0x29d3ad;};const _0x1b5a70=a316_0x29d3;'use strict';const _=require(_0x1b5a70('0x30')),qs=require(_0x1b5a70('0x11')),logger=require(_0x1b5a70('0x10'))('api'),db=require('../../mysqldb')['db'],{Op}=require(_0x1b5a70('0x0'));function respondWithResult(_0x336c36,_0x3114d3){return _0x3114d3=_0x3114d3||0xc8,function(_0x3e355c){const _0x133540=a316_0x29d3;if(_0x3e355c)return _0x336c36[_0x133540('0x1c')](_0x3114d3)[_0x133540('0x16')](_0x3e355c);};}function respondWithFilteredResult(_0x538f71,_0x656709){return function(_0x8f2b){const _0x1b1e22=a316_0x29d3;if(_0x8f2b){const _0x5a2062=_0x8f2b['count'],_0x36859b=_0x656709['offset'];let _0x372c41=_0x656709[_0x1b1e22('0x1a')]+_0x656709[_0x1b1e22('0x2e')],_0xc4f7ca;return _0x372c41>=_0x5a2062?(_0x372c41=_0x5a2062,_0xc4f7ca=0xc8):_0xc4f7ca=0xce,_0x538f71[_0x1b1e22('0x1c')](_0xc4f7ca),_0x538f71[_0x1b1e22('0x2b')]('Content-Range',_0x36859b+'-'+_0x372c41+'/'+_0x5a2062)[_0x1b1e22('0x16')](_0x8f2b);}return null;};}function saveUpdates(_0x13f833){return function(_0xdfdb65){const _0x1ed0ea=a316_0x29d3;if(_0xdfdb65)return _0xdfdb65[_0x1ed0ea('0xa')](_0x13f833)[_0x1ed0ea('0x8')](function(_0x43d59f){return _0x43d59f;});return null;};}function removeEntity(_0x4c43f1){return function(_0x3e55c1){const _0x39a85a=a316_0x29d3;if(_0x3e55c1)return _0x3e55c1[_0x39a85a('0x2')]()['then'](function(){const _0x221122=_0x39a85a;_0x4c43f1['status'](0xcc)[_0x221122('0x6')]();});};}function handleEntityNotFound(_0x3b06ae){return function(_0x261d99){const _0x214d5a=a316_0x29d3;return!_0x261d99&&_0x3b06ae[_0x214d5a('0x28')](0x194),_0x261d99;};}function handleError(_0x1a8ba4,_0x29a3e0){return _0x29a3e0=_0x29a3e0||0x1f4,function(_0x18b598){const _0x47d2b4=a316_0x29d3;logger['error'](_0x18b598['stack']),_0x18b598[_0x47d2b4('0x24')]&&delete _0x18b598[_0x47d2b4('0x24')],_0x1a8ba4[_0x47d2b4('0x1c')](_0x29a3e0)[_0x47d2b4('0x22')](_0x18b598);};}exports[_0x1b5a70('0x2c')]=function(_0x332526,_0x2b842b){const _0x27b115=_0x1b5a70;let _0x5b92bb={};const _0x574321={},_0x205544={'count':0x0,'rows':[]},_0x31f7e8=_[_0x27b115('0x12')](db[_0x27b115('0xb')][_0x27b115('0x4')],function(_0x16f0ab){const _0x5f04ff=_0x27b115;return{'name':_0x16f0ab['fieldName'],'type':_0x16f0ab[_0x5f04ff('0x29')][_0x5f04ff('0x23')]};});_0x574321['model']=_[_0x27b115('0x12')](_0x31f7e8,_0x27b115('0x24')),_0x574321[_0x27b115('0x19')]=_['keys'](_0x332526[_0x27b115('0x19')]),_0x574321['filters']=_['intersection'](_0x574321[_0x27b115('0x5')],_0x574321[_0x27b115('0x19')]),_0x5b92bb['attributes']=_[_0x27b115('0x13')](_0x574321[_0x27b115('0x5')],qs[_0x27b115('0x1b')](_0x332526[_0x27b115('0x19')][_0x27b115('0x1b')])),_0x5b92bb[_0x27b115('0x17')]=_0x5b92bb[_0x27b115('0x17')][_0x27b115('0x2f')]?_0x5b92bb[_0x27b115('0x17')]:_0x574321[_0x27b115('0x5')];typeof _0x332526[_0x27b115('0x19')][_0x27b115('0x7')]===_0x27b115('0x26')&&(_0x5b92bb['limit']=qs[_0x27b115('0x2e')](_0x332526[_0x27b115('0x19')][_0x27b115('0x2e')]),_0x5b92bb['offset']=qs[_0x27b115('0x1a')](_0x332526[_0x27b115('0x19')][_0x27b115('0x1a')]));_0x5b92bb[_0x27b115('0x9')]=qs[_0x27b115('0xe')](_0x332526[_0x27b115('0x19')]['sort']),_0x5b92bb['where']=qs[_0x27b115('0x15')](_[_0x27b115('0x20')](_0x332526[_0x27b115('0x19')],_0x574321[_0x27b115('0x15')]),_0x31f7e8);_0x332526[_0x27b115('0x19')]['filter']&&(_0x5b92bb[_0x27b115('0x1e')]=_['merge'](_0x5b92bb[_0x27b115('0x1e')],{[Op['or']]:_[_0x27b115('0x12')](_0x31f7e8,function(_0x390a1d){const _0x5a0704=_0x27b115;if(_0x390a1d['type']!==_0x5a0704('0x25')){const _0x5c9b74={};return _0x5c9b74[_0x390a1d[_0x5a0704('0x24')]]={[Op[_0x5a0704('0xc')]]:'%'+_0x332526[_0x5a0704('0x19')][_0x5a0704('0xd')]+'%'},_0x5c9b74;}})}));_0x5b92bb=_['merge']({},_0x5b92bb,_0x332526[_0x27b115('0x2a')]);const _0x7cb247={'where':_0x5b92bb[_0x27b115('0x1e')]};return db[_0x27b115('0xb')][_0x27b115('0x31')](_0x7cb247)[_0x27b115('0x8')](function(_0x75313c){const _0x573496=_0x27b115;return _0x205544[_0x573496('0x31')]=_0x75313c,_0x332526[_0x573496('0x19')][_0x573496('0x14')]&&(_0x5b92bb[_0x573496('0x1d')]=[{'all':!![]}]),db[_0x573496('0xb')]['findAll'](_0x5b92bb);})[_0x27b115('0x8')](function(_0x316ff1){const _0x27cc5f=_0x27b115;return _0x205544[_0x27cc5f('0xf')]=_0x316ff1,_0x205544;})[_0x27b115('0x8')](respondWithFilteredResult(_0x2b842b,_0x5b92bb))[_0x27b115('0x27')](handleError(_0x2b842b,null));},exports[_0x1b5a70('0x1f')]=function(_0x53dfce,_0xce05d8){const _0x24e1c8=_0x1b5a70;let _0x8c3ca3={'raw':!![],'where':{'id':_0x53dfce[_0x24e1c8('0x18')]['id']}};const _0x4b3d93={};return _0x4b3d93[_0x24e1c8('0x5')]=_['keys'](db[_0x24e1c8('0xb')][_0x24e1c8('0x4')]),_0x4b3d93[_0x24e1c8('0x19')]=_[_0x24e1c8('0x3')](_0x53dfce['query']),_0x4b3d93[_0x24e1c8('0x15')]=_[_0x24e1c8('0x13')](_0x4b3d93[_0x24e1c8('0x5')],_0x4b3d93[_0x24e1c8('0x19')]),_0x8c3ca3[_0x24e1c8('0x17')]=_['intersection'](_0x4b3d93[_0x24e1c8('0x5')],qs['fields'](_0x53dfce[_0x24e1c8('0x19')][_0x24e1c8('0x1b')])),_0x8c3ca3[_0x24e1c8('0x17')]=_0x8c3ca3[_0x24e1c8('0x17')]['length']?_0x8c3ca3[_0x24e1c8('0x17')]:_0x4b3d93[_0x24e1c8('0x5')],_0x53dfce[_0x24e1c8('0x19')]['includeAll']&&(_0x8c3ca3[_0x24e1c8('0x1d')]=[{'all':!![]}]),_0x8c3ca3=_[_0x24e1c8('0x1')]({},_0x8c3ca3,_0x53dfce[_0x24e1c8('0x2a')]),db[_0x24e1c8('0xb')][_0x24e1c8('0x21')](_0x8c3ca3)[_0x24e1c8('0x8')](handleEntityNotFound(_0xce05d8,null))[_0x24e1c8('0x8')](respondWithResult(_0xce05d8,null))[_0x24e1c8('0x27')](handleError(_0xce05d8,null));},exports['create']=function(_0x44e32f,_0x530ca4){const _0xbc3a49=_0x1b5a70;return db[_0xbc3a49('0xb')]['create'](_0x44e32f[_0xbc3a49('0x2d')],{})[_0xbc3a49('0x8')](respondWithResult(_0x530ca4,0xc9))[_0xbc3a49('0x27')](handleError(_0x530ca4,null));},exports[_0x1b5a70('0xa')]=function(_0x271223,_0x3b5aed){const _0x249521=_0x1b5a70;return _0x271223['body']['id']&&delete _0x271223['body']['id'],db[_0x249521('0xb')][_0x249521('0x21')]({'where':{'id':_0x271223[_0x249521('0x18')]['id']}})['then'](handleEntityNotFound(_0x3b5aed,null))['then'](saveUpdates(_0x271223[_0x249521('0x2d')],null))[_0x249521('0x8')](respondWithResult(_0x3b5aed,null))[_0x249521('0x27')](handleError(_0x3b5aed,null));},exports[_0x1b5a70('0x2')]=function(_0x27dd84,_0x4d983a){const _0x29e8fa=_0x1b5a70;return db[_0x29e8fa('0xb')][_0x29e8fa('0x21')]({'where':{'id':_0x27dd84[_0x29e8fa('0x18')]['id']}})[_0x29e8fa('0x8')](handleEntityNotFound(_0x4d983a,null))['then'](removeEntity(_0x4d983a,null))[_0x29e8fa('0x27')](handleError(_0x4d983a,null));};
\ No newline at end of file
+const a316_0x5ad9=['catch','fieldName','offset','map','api','intersection','../../config/logger','where','model','pick','attributes','length','limit','../../mysqldb','count','destroy','json','../../components/parsers/qs','merge','sort','options','sendStatus','params','order','lodash','undefined','index','findAll','create','type','send','rows','key','include','stack','like','VIRTUAL','fields','findOne','status','Content-Range','query','rawAttributes','end','name','filter','SugarcrmField','sequelize','keys','body','filters','nolimit','then','includeAll'];(function(_0x1cbd2c,_0x5ad9ce){const _0x5460b8=function(_0x2864b3){while(--_0x2864b3){_0x1cbd2c['push'](_0x1cbd2c['shift']());}};_0x5460b8(++_0x5ad9ce);}(a316_0x5ad9,0x1ca));const a316_0x5460=function(_0x1cbd2c,_0x5ad9ce){_0x1cbd2c=_0x1cbd2c-0x0;let _0x5460b8=a316_0x5ad9[_0x1cbd2c];return _0x5460b8;};const _0x592f93=a316_0x5460;'use strict';const _=require(_0x592f93('0x34')),qs=require(_0x592f93('0x2d')),logger=require(_0x592f93('0x22'))(_0x592f93('0x20')),db=require(_0x592f93('0x29'))['db'],{Op}=require(_0x592f93('0x15'));function respondWithResult(_0x2864b3,_0x49e2b1){return _0x49e2b1=_0x49e2b1||0xc8,function(_0x3612f5){const _0x3c04c5=a316_0x5460;if(_0x3612f5)return _0x2864b3[_0x3c04c5('0xd')](_0x49e2b1)[_0x3c04c5('0x2c')](_0x3612f5);};}function respondWithFilteredResult(_0x32e37b,_0x5391a7){return function(_0x2d0462){const _0x13c9d3=a316_0x5460;if(_0x2d0462){const _0xa0e6bd=_0x2d0462[_0x13c9d3('0x2a')],_0x12bb78=_0x5391a7[_0x13c9d3('0x1e')];let _0x2c18fe=_0x5391a7[_0x13c9d3('0x1e')]+_0x5391a7[_0x13c9d3('0x28')],_0x3180a8;return _0x2c18fe>=_0xa0e6bd?(_0x2c18fe=_0xa0e6bd,_0x3180a8=0xc8):_0x3180a8=0xce,_0x32e37b[_0x13c9d3('0xd')](_0x3180a8),_0x32e37b['set'](_0x13c9d3('0xe'),_0x12bb78+'-'+_0x2c18fe+'/'+_0xa0e6bd)[_0x13c9d3('0x2c')](_0x2d0462);}return null;};}function saveUpdates(_0x483453){return function(_0x11b602){const _0x22c563=a316_0x5460;if(_0x11b602)return _0x11b602['update'](_0x483453)[_0x22c563('0x1a')](function(_0x1643f8){return _0x1643f8;});return null;};}function removeEntity(_0x3e9dbc){return function(_0x707546){const _0x2eae4a=a316_0x5460;if(_0x707546)return _0x707546[_0x2eae4a('0x2b')]()[_0x2eae4a('0x1a')](function(){const _0x2777df=_0x2eae4a;_0x3e9dbc[_0x2777df('0xd')](0xcc)[_0x2777df('0x11')]();});};}function handleEntityNotFound(_0x163d5c){return function(_0x220ad2){const _0x44d688=a316_0x5460;return!_0x220ad2&&_0x163d5c[_0x44d688('0x31')](0x194),_0x220ad2;};}function handleError(_0x3f4cfe,_0x14cb7f){return _0x14cb7f=_0x14cb7f||0x1f4,function(_0x508712){const _0x24bd76=a316_0x5460;logger['error'](_0x508712[_0x24bd76('0x8')]),_0x508712[_0x24bd76('0x12')]&&delete _0x508712[_0x24bd76('0x12')],_0x3f4cfe[_0x24bd76('0xd')](_0x14cb7f)[_0x24bd76('0x4')](_0x508712);};}exports[_0x592f93('0x0')]=function(_0x5e4939,_0x590465){const _0x2d6418=_0x592f93;let _0x20ca8f={};const _0x4b4980={},_0x41579d={'count':0x0,'rows':[]},_0x42142b=_['map'](db[_0x2d6418('0x14')][_0x2d6418('0x10')],function(_0x2e7f0f){const _0x1fbe4b=_0x2d6418;return{'name':_0x2e7f0f[_0x1fbe4b('0x1d')],'type':_0x2e7f0f[_0x1fbe4b('0x3')][_0x1fbe4b('0x6')]};});_0x4b4980[_0x2d6418('0x24')]=_[_0x2d6418('0x1f')](_0x42142b,'name'),_0x4b4980[_0x2d6418('0xf')]=_[_0x2d6418('0x16')](_0x5e4939[_0x2d6418('0xf')]),_0x4b4980[_0x2d6418('0x18')]=_[_0x2d6418('0x21')](_0x4b4980[_0x2d6418('0x24')],_0x4b4980[_0x2d6418('0xf')]),_0x20ca8f[_0x2d6418('0x26')]=_[_0x2d6418('0x21')](_0x4b4980[_0x2d6418('0x24')],qs[_0x2d6418('0xb')](_0x5e4939['query'][_0x2d6418('0xb')])),_0x20ca8f[_0x2d6418('0x26')]=_0x20ca8f['attributes']['length']?_0x20ca8f[_0x2d6418('0x26')]:_0x4b4980[_0x2d6418('0x24')];typeof _0x5e4939[_0x2d6418('0xf')][_0x2d6418('0x19')]===_0x2d6418('0x35')&&(_0x20ca8f[_0x2d6418('0x28')]=qs['limit'](_0x5e4939[_0x2d6418('0xf')][_0x2d6418('0x28')]),_0x20ca8f['offset']=qs[_0x2d6418('0x1e')](_0x5e4939['query'][_0x2d6418('0x1e')]));_0x20ca8f[_0x2d6418('0x33')]=qs[_0x2d6418('0x2f')](_0x5e4939[_0x2d6418('0xf')][_0x2d6418('0x2f')]),_0x20ca8f[_0x2d6418('0x23')]=qs[_0x2d6418('0x18')](_[_0x2d6418('0x25')](_0x5e4939[_0x2d6418('0xf')],_0x4b4980[_0x2d6418('0x18')]),_0x42142b);_0x5e4939[_0x2d6418('0xf')][_0x2d6418('0x13')]&&(_0x20ca8f[_0x2d6418('0x23')]=_[_0x2d6418('0x2e')](_0x20ca8f[_0x2d6418('0x23')],{[Op['or']]:_[_0x2d6418('0x1f')](_0x42142b,function(_0xebd463){const _0x55cf71=_0x2d6418;if(_0xebd463['type']!==_0x55cf71('0xa')){const _0xcd9c4f={};return _0xcd9c4f[_0xebd463[_0x55cf71('0x12')]]={[Op[_0x55cf71('0x9')]]:'%'+_0x5e4939['query'][_0x55cf71('0x13')]+'%'},_0xcd9c4f;}})}));_0x20ca8f=_[_0x2d6418('0x2e')]({},_0x20ca8f,_0x5e4939[_0x2d6418('0x30')]);const _0x41640a={'where':_0x20ca8f[_0x2d6418('0x23')]};return db[_0x2d6418('0x14')][_0x2d6418('0x2a')](_0x41640a)[_0x2d6418('0x1a')](function(_0x466065){const _0xb33267=_0x2d6418;return _0x41579d[_0xb33267('0x2a')]=_0x466065,_0x5e4939[_0xb33267('0xf')][_0xb33267('0x1b')]&&(_0x20ca8f[_0xb33267('0x7')]=[{'all':!![]}]),db[_0xb33267('0x14')][_0xb33267('0x1')](_0x20ca8f);})[_0x2d6418('0x1a')](function(_0x1e4c80){const _0x5a5a39=_0x2d6418;return _0x41579d[_0x5a5a39('0x5')]=_0x1e4c80,_0x41579d;})['then'](respondWithFilteredResult(_0x590465,_0x20ca8f))[_0x2d6418('0x1c')](handleError(_0x590465,null));},exports['show']=function(_0xbd40a6,_0x1e70d4){const _0x4f4942=_0x592f93;let _0x2e1347={'raw':!![],'where':{'id':_0xbd40a6[_0x4f4942('0x32')]['id']}};const _0xcaec5a={};return _0xcaec5a[_0x4f4942('0x24')]=_[_0x4f4942('0x16')](db[_0x4f4942('0x14')]['rawAttributes']),_0xcaec5a['query']=_['keys'](_0xbd40a6[_0x4f4942('0xf')]),_0xcaec5a[_0x4f4942('0x18')]=_[_0x4f4942('0x21')](_0xcaec5a[_0x4f4942('0x24')],_0xcaec5a[_0x4f4942('0xf')]),_0x2e1347['attributes']=_[_0x4f4942('0x21')](_0xcaec5a['model'],qs[_0x4f4942('0xb')](_0xbd40a6[_0x4f4942('0xf')][_0x4f4942('0xb')])),_0x2e1347['attributes']=_0x2e1347[_0x4f4942('0x26')][_0x4f4942('0x27')]?_0x2e1347[_0x4f4942('0x26')]:_0xcaec5a[_0x4f4942('0x24')],_0xbd40a6[_0x4f4942('0xf')][_0x4f4942('0x1b')]&&(_0x2e1347[_0x4f4942('0x7')]=[{'all':!![]}]),_0x2e1347=_['merge']({},_0x2e1347,_0xbd40a6[_0x4f4942('0x30')]),db[_0x4f4942('0x14')][_0x4f4942('0xc')](_0x2e1347)[_0x4f4942('0x1a')](handleEntityNotFound(_0x1e70d4,null))[_0x4f4942('0x1a')](respondWithResult(_0x1e70d4,null))[_0x4f4942('0x1c')](handleError(_0x1e70d4,null));},exports[_0x592f93('0x2')]=function(_0x124780,_0x1e8fa2){const _0x1e9338=_0x592f93;return db[_0x1e9338('0x14')][_0x1e9338('0x2')](_0x124780[_0x1e9338('0x17')],{})['then'](respondWithResult(_0x1e8fa2,0xc9))['catch'](handleError(_0x1e8fa2,null));},exports['update']=function(_0x3be29e,_0x56cf98){const _0x128ae8=_0x592f93;return _0x3be29e[_0x128ae8('0x17')]['id']&&delete _0x3be29e[_0x128ae8('0x17')]['id'],db[_0x128ae8('0x14')][_0x128ae8('0xc')]({'where':{'id':_0x3be29e[_0x128ae8('0x32')]['id']}})[_0x128ae8('0x1a')](handleEntityNotFound(_0x56cf98,null))[_0x128ae8('0x1a')](saveUpdates(_0x3be29e[_0x128ae8('0x17')],null))[_0x128ae8('0x1a')](respondWithResult(_0x56cf98,null))[_0x128ae8('0x1c')](handleError(_0x56cf98,null));},exports['destroy']=function(_0x406ecd,_0xcda91c){const _0x49432d=_0x592f93;return db[_0x49432d('0x14')][_0x49432d('0xc')]({'where':{'id':_0x406ecd[_0x49432d('0x32')]['id']}})['then'](handleEntityNotFound(_0xcda91c,null))[_0x49432d('0x1a')](removeEntity(_0xcda91c,null))['catch'](handleError(_0xcda91c,null));};
\ No newline at end of file