Built motion from commit c49361c37b5f784889c8087ac6e0e91b7e6b561a. Version 3.0.0...
[motion-next.git] / server / api / intSugarcrmField / intSugarcrmField.controller.js
index 8ca9e8b..a53c3f8 100644 (file)
@@ -1 +1 @@
-const a316_0x3d5f=['filters','model','include','update','status','name','index','catch','findOne','count','set','where','merge','query','fieldName','pick','api','send','intersection','includeAll','destroy','body','error','nolimit','limit','length','create','map','../../components/parsers/qs','lodash','key','offset','SugarcrmField','findAll','../../mysqldb','fields','undefined','keys','filter','like','sendStatus','../../config/logger','Content-Range','VIRTUAL','order','sort','then','rawAttributes','show','attributes','rows','options','json','type','params','sequelize','end'];(function(_0x33ba74,_0x3d5f9f){const _0x1a2c98=function(_0x4c6bbf){while(--_0x4c6bbf){_0x33ba74['push'](_0x33ba74['shift']());}};_0x1a2c98(++_0x3d5f9f);}(a316_0x3d5f,0xa4));const a316_0x1a2c=function(_0x33ba74,_0x3d5f9f){_0x33ba74=_0x33ba74-0x0;let _0x1a2c98=a316_0x3d5f[_0x33ba74];return _0x1a2c98;};const _0x13fd6c=a316_0x1a2c;'use strict';const _=require(_0x13fd6c('0x24')),qs=require(_0x13fd6c('0x23')),logger=require(_0x13fd6c('0x30'))(_0x13fd6c('0x17')),db=require(_0x13fd6c('0x29'))['db'],{Op}=require(_0x13fd6c('0x5'));function respondWithResult(_0x4c6bbf,_0x47c039){return _0x47c039=_0x47c039||0xc8,function(_0x5d80b7){const _0x46a6ed=a316_0x1a2c;if(_0x5d80b7)return _0x4c6bbf[_0x46a6ed('0xb')](_0x47c039)[_0x46a6ed('0x2')](_0x5d80b7);};}function respondWithFilteredResult(_0x53f244,_0x22ea76){return function(_0x141c5f){const _0x165b6e=a316_0x1a2c;if(_0x141c5f){const _0x45ff9e=_0x141c5f[_0x165b6e('0x10')],_0x132035=_0x22ea76['offset'];let _0x5eaea8=_0x22ea76[_0x165b6e('0x26')]+_0x22ea76[_0x165b6e('0x1f')],_0x56a1af;return _0x5eaea8>=_0x45ff9e?(_0x5eaea8=_0x45ff9e,_0x56a1af=0xc8):_0x56a1af=0xce,_0x53f244[_0x165b6e('0xb')](_0x56a1af),_0x53f244[_0x165b6e('0x11')](_0x165b6e('0x31'),_0x132035+'-'+_0x5eaea8+'/'+_0x45ff9e)[_0x165b6e('0x2')](_0x141c5f);}return null;};}function saveUpdates(_0x1f5f44){return function(_0x5cff87){const _0x26e195=a316_0x1a2c;if(_0x5cff87)return _0x5cff87[_0x26e195('0xa')](_0x1f5f44)['then'](function(_0x5eceb9){return _0x5eceb9;});return null;};}function removeEntity(_0x46d3db){return function(_0x41cd71){const _0xa928d5=a316_0x1a2c;if(_0x41cd71)return _0x41cd71['destroy']()[_0xa928d5('0x35')](function(){const _0x5530c7=_0xa928d5;_0x46d3db[_0x5530c7('0xb')](0xcc)[_0x5530c7('0x6')]();});};}function handleEntityNotFound(_0xd14f1){return function(_0x1a8297){const _0x542ef8=a316_0x1a2c;return!_0x1a8297&&_0xd14f1[_0x542ef8('0x2f')](0x194),_0x1a8297;};}function handleError(_0x300414,_0x1ebbf5){return _0x1ebbf5=_0x1ebbf5||0x1f4,function(_0x2d72e2){const _0x2c12d6=a316_0x1a2c;logger[_0x2c12d6('0x1d')](_0x2d72e2['stack']),_0x2d72e2[_0x2c12d6('0xc')]&&delete _0x2d72e2['name'],_0x300414[_0x2c12d6('0xb')](_0x1ebbf5)[_0x2c12d6('0x18')](_0x2d72e2);};}exports[_0x13fd6c('0xd')]=function(_0x3f6c08,_0x441cb2){const _0x3acd04=_0x13fd6c;let _0x1f93fc={};const _0x2fc1fc={},_0x500a87={'count':0x0,'rows':[]},_0x4d2bdd=_[_0x3acd04('0x22')](db['SugarcrmField'][_0x3acd04('0x36')],function(_0x170634){const _0x9e60b3=_0x3acd04;return{'name':_0x170634[_0x9e60b3('0x15')],'type':_0x170634[_0x9e60b3('0x3')][_0x9e60b3('0x25')]};});_0x2fc1fc['model']=_[_0x3acd04('0x22')](_0x4d2bdd,'name'),_0x2fc1fc[_0x3acd04('0x14')]=_['keys'](_0x3f6c08['query']),_0x2fc1fc['filters']=_['intersection'](_0x2fc1fc[_0x3acd04('0x8')],_0x2fc1fc[_0x3acd04('0x14')]),_0x1f93fc[_0x3acd04('0x38')]=_['intersection'](_0x2fc1fc[_0x3acd04('0x8')],qs['fields'](_0x3f6c08[_0x3acd04('0x14')][_0x3acd04('0x2a')])),_0x1f93fc[_0x3acd04('0x38')]=_0x1f93fc[_0x3acd04('0x38')][_0x3acd04('0x20')]?_0x1f93fc[_0x3acd04('0x38')]:_0x2fc1fc[_0x3acd04('0x8')];typeof _0x3f6c08[_0x3acd04('0x14')][_0x3acd04('0x1e')]===_0x3acd04('0x2b')&&(_0x1f93fc[_0x3acd04('0x1f')]=qs[_0x3acd04('0x1f')](_0x3f6c08['query'][_0x3acd04('0x1f')]),_0x1f93fc[_0x3acd04('0x26')]=qs['offset'](_0x3f6c08[_0x3acd04('0x14')][_0x3acd04('0x26')]));_0x1f93fc[_0x3acd04('0x33')]=qs[_0x3acd04('0x34')](_0x3f6c08[_0x3acd04('0x14')]['sort']),_0x1f93fc[_0x3acd04('0x12')]=qs[_0x3acd04('0x7')](_[_0x3acd04('0x16')](_0x3f6c08[_0x3acd04('0x14')],_0x2fc1fc[_0x3acd04('0x7')]),_0x4d2bdd);_0x3f6c08['query']['filter']&&(_0x1f93fc[_0x3acd04('0x12')]=_[_0x3acd04('0x13')](_0x1f93fc['where'],{[Op['or']]:_[_0x3acd04('0x22')](_0x4d2bdd,function(_0x17f08){const _0x56c0d5=_0x3acd04;if(_0x17f08[_0x56c0d5('0x3')]!==_0x56c0d5('0x32')){const _0x20cbb6={};return _0x20cbb6[_0x17f08[_0x56c0d5('0xc')]]={[Op[_0x56c0d5('0x2e')]]:'%'+_0x3f6c08['query'][_0x56c0d5('0x2d')]+'%'},_0x20cbb6;}})}));_0x1f93fc=_[_0x3acd04('0x13')]({},_0x1f93fc,_0x3f6c08[_0x3acd04('0x1')]);const _0x36df2d={'where':_0x1f93fc[_0x3acd04('0x12')]};return db['SugarcrmField'][_0x3acd04('0x10')](_0x36df2d)['then'](function(_0x3472f8){const _0x47085a=_0x3acd04;return _0x500a87[_0x47085a('0x10')]=_0x3472f8,_0x3f6c08[_0x47085a('0x14')][_0x47085a('0x1a')]&&(_0x1f93fc[_0x47085a('0x9')]=[{'all':!![]}]),db[_0x47085a('0x27')][_0x47085a('0x28')](_0x1f93fc);})[_0x3acd04('0x35')](function(_0x3e1e47){const _0x5cbe5d=_0x3acd04;return _0x500a87[_0x5cbe5d('0x0')]=_0x3e1e47,_0x500a87;})[_0x3acd04('0x35')](respondWithFilteredResult(_0x441cb2,_0x1f93fc))[_0x3acd04('0xe')](handleError(_0x441cb2,null));},exports[_0x13fd6c('0x37')]=function(_0x5d7a52,_0x17fe42){const _0x270626=_0x13fd6c;let _0x578d0f={'raw':!![],'where':{'id':_0x5d7a52['params']['id']}};const _0x25ee92={};return _0x25ee92[_0x270626('0x8')]=_[_0x270626('0x2c')](db[_0x270626('0x27')][_0x270626('0x36')]),_0x25ee92[_0x270626('0x14')]=_[_0x270626('0x2c')](_0x5d7a52['query']),_0x25ee92[_0x270626('0x7')]=_[_0x270626('0x19')](_0x25ee92[_0x270626('0x8')],_0x25ee92[_0x270626('0x14')]),_0x578d0f[_0x270626('0x38')]=_['intersection'](_0x25ee92[_0x270626('0x8')],qs['fields'](_0x5d7a52['query'][_0x270626('0x2a')])),_0x578d0f[_0x270626('0x38')]=_0x578d0f[_0x270626('0x38')][_0x270626('0x20')]?_0x578d0f[_0x270626('0x38')]:_0x25ee92[_0x270626('0x8')],_0x5d7a52['query']['includeAll']&&(_0x578d0f[_0x270626('0x9')]=[{'all':!![]}]),_0x578d0f=_[_0x270626('0x13')]({},_0x578d0f,_0x5d7a52[_0x270626('0x1')]),db[_0x270626('0x27')][_0x270626('0xf')](_0x578d0f)[_0x270626('0x35')](handleEntityNotFound(_0x17fe42,null))[_0x270626('0x35')](respondWithResult(_0x17fe42,null))['catch'](handleError(_0x17fe42,null));},exports[_0x13fd6c('0x21')]=function(_0x5ea66d,_0x14079c){const _0x29be23=_0x13fd6c;return db[_0x29be23('0x27')][_0x29be23('0x21')](_0x5ea66d['body'],{})[_0x29be23('0x35')](respondWithResult(_0x14079c,0xc9))[_0x29be23('0xe')](handleError(_0x14079c,null));},exports['update']=function(_0x58245e,_0x2469b9){const _0x1c46cd=_0x13fd6c;return _0x58245e[_0x1c46cd('0x1c')]['id']&&delete _0x58245e['body']['id'],db[_0x1c46cd('0x27')][_0x1c46cd('0xf')]({'where':{'id':_0x58245e[_0x1c46cd('0x4')]['id']}})['then'](handleEntityNotFound(_0x2469b9,null))[_0x1c46cd('0x35')](saveUpdates(_0x58245e[_0x1c46cd('0x1c')],null))[_0x1c46cd('0x35')](respondWithResult(_0x2469b9,null))[_0x1c46cd('0xe')](handleError(_0x2469b9,null));},exports[_0x13fd6c('0x1b')]=function(_0x35013f,_0x379546){const _0x2d6f7f=_0x13fd6c;return db[_0x2d6f7f('0x27')][_0x2d6f7f('0xf')]({'where':{'id':_0x35013f[_0x2d6f7f('0x4')]['id']}})[_0x2d6f7f('0x35')](handleEntityNotFound(_0x379546,null))[_0x2d6f7f('0x35')](removeEntity(_0x379546,null))[_0x2d6f7f('0xe')](handleError(_0x379546,null));};
\ No newline at end of file
+const a316_0xe963=['SugarcrmField','attributes','name','key','query','body','status','update','show','undefined','filters','limit','stack','destroy','type','json','merge','api','include','fieldName','end','send','model','../../components/parsers/qs','order','map','params','filter','includeAll','catch','sendStatus','sort','fields','../../mysqldb','then','rawAttributes','lodash','length','../../config/logger','offset','error','keys','options','count','where','create','nolimit','findOne'];(function(_0x2311ae,_0xe9638e){const _0x4dd124=function(_0x2495ad){while(--_0x2495ad){_0x2311ae['push'](_0x2311ae['shift']());}};_0x4dd124(++_0xe9638e);}(a316_0xe963,0x157));const a316_0x4dd1=function(_0x2311ae,_0xe9638e){_0x2311ae=_0x2311ae-0x0;let _0x4dd124=a316_0xe963[_0x2311ae];return _0x4dd124;};const _0x158eb9=a316_0x4dd1;'use strict';const _=require(_0x158eb9('0x1d')),qs=require(_0x158eb9('0x10')),logger=require(_0x158eb9('0x1f'))(_0x158eb9('0xa')),db=require(_0x158eb9('0x1a'))['db'],{Op}=require('sequelize');function respondWithResult(_0x2495ad,_0x4a94be){return _0x4a94be=_0x4a94be||0xc8,function(_0x37680a){if(_0x37680a)return _0x2495ad['status'](_0x4a94be)['json'](_0x37680a);};}function respondWithFilteredResult(_0x1544ad,_0x1626e6){return function(_0x42838c){const _0x7973c0=a316_0x4dd1;if(_0x42838c){const _0x3dc22e=_0x42838c[_0x7973c0('0x24')],_0x2450fe=_0x1626e6[_0x7973c0('0x20')];let _0x2fa54b=_0x1626e6[_0x7973c0('0x20')]+_0x1626e6[_0x7973c0('0x4')],_0x25db98;return _0x2fa54b>=_0x3dc22e?(_0x2fa54b=_0x3dc22e,_0x25db98=0xc8):_0x25db98=0xce,_0x1544ad[_0x7973c0('0x2f')](_0x25db98),_0x1544ad['set']('Content-Range',_0x2450fe+'-'+_0x2fa54b+'/'+_0x3dc22e)[_0x7973c0('0x8')](_0x42838c);}return null;};}function saveUpdates(_0x1e5651){return function(_0x5bcce5){const _0x30561d=a316_0x4dd1;if(_0x5bcce5)return _0x5bcce5[_0x30561d('0x0')](_0x1e5651)[_0x30561d('0x1b')](function(_0x343992){return _0x343992;});return null;};}function removeEntity(_0x3b0442){return function(_0x1695c7){const _0x251d53=a316_0x4dd1;if(_0x1695c7)return _0x1695c7[_0x251d53('0x6')]()[_0x251d53('0x1b')](function(){const _0x4a0cba=_0x251d53;_0x3b0442[_0x4a0cba('0x2f')](0xcc)[_0x4a0cba('0xd')]();});};}function handleEntityNotFound(_0xdb33e){return function(_0x5d8a79){const _0x351342=a316_0x4dd1;return!_0x5d8a79&&_0xdb33e[_0x351342('0x17')](0x194),_0x5d8a79;};}function handleError(_0x51b134,_0x31d2eb){return _0x31d2eb=_0x31d2eb||0x1f4,function(_0xde477b){const _0x7af15c=a316_0x4dd1;logger[_0x7af15c('0x21')](_0xde477b[_0x7af15c('0x5')]),_0xde477b[_0x7af15c('0x2b')]&&delete _0xde477b[_0x7af15c('0x2b')],_0x51b134['status'](_0x31d2eb)[_0x7af15c('0xe')](_0xde477b);};}exports['index']=function(_0x24e647,_0x468dcd){const _0x5207f3=_0x158eb9;let _0x3defb2={};const _0x409893={},_0x357be4={'count':0x0,'rows':[]},_0x59d2b0=_['map'](db['SugarcrmField']['rawAttributes'],function(_0x286240){const _0x154d44=a316_0x4dd1;return{'name':_0x286240[_0x154d44('0xc')],'type':_0x286240[_0x154d44('0x7')][_0x154d44('0x2c')]};});_0x409893['model']=_['map'](_0x59d2b0,_0x5207f3('0x2b')),_0x409893[_0x5207f3('0x2d')]=_[_0x5207f3('0x22')](_0x24e647[_0x5207f3('0x2d')]),_0x409893[_0x5207f3('0x3')]=_['intersection'](_0x409893[_0x5207f3('0xf')],_0x409893[_0x5207f3('0x2d')]),_0x3defb2[_0x5207f3('0x2a')]=_['intersection'](_0x409893[_0x5207f3('0xf')],qs['fields'](_0x24e647[_0x5207f3('0x2d')][_0x5207f3('0x19')])),_0x3defb2['attributes']=_0x3defb2[_0x5207f3('0x2a')][_0x5207f3('0x1e')]?_0x3defb2[_0x5207f3('0x2a')]:_0x409893[_0x5207f3('0xf')];typeof _0x24e647[_0x5207f3('0x2d')][_0x5207f3('0x27')]===_0x5207f3('0x2')&&(_0x3defb2[_0x5207f3('0x4')]=qs['limit'](_0x24e647[_0x5207f3('0x2d')][_0x5207f3('0x4')]),_0x3defb2[_0x5207f3('0x20')]=qs[_0x5207f3('0x20')](_0x24e647[_0x5207f3('0x2d')][_0x5207f3('0x20')]));_0x3defb2[_0x5207f3('0x11')]=qs[_0x5207f3('0x18')](_0x24e647['query'][_0x5207f3('0x18')]),_0x3defb2[_0x5207f3('0x25')]=qs['filters'](_['pick'](_0x24e647[_0x5207f3('0x2d')],_0x409893[_0x5207f3('0x3')]),_0x59d2b0);_0x24e647[_0x5207f3('0x2d')][_0x5207f3('0x14')]&&(_0x3defb2[_0x5207f3('0x25')]=_[_0x5207f3('0x9')](_0x3defb2[_0x5207f3('0x25')],{[Op['or']]:_[_0x5207f3('0x12')](_0x59d2b0,function(_0x2e5b40){const _0x1e5544=_0x5207f3;if(_0x2e5b40['type']!=='VIRTUAL'){const _0x1aaa12={};return _0x1aaa12[_0x2e5b40[_0x1e5544('0x2b')]]={[Op['like']]:'%'+_0x24e647[_0x1e5544('0x2d')][_0x1e5544('0x14')]+'%'},_0x1aaa12;}})}));_0x3defb2=_[_0x5207f3('0x9')]({},_0x3defb2,_0x24e647[_0x5207f3('0x23')]);const _0x17619a={'where':_0x3defb2[_0x5207f3('0x25')]};return db[_0x5207f3('0x29')][_0x5207f3('0x24')](_0x17619a)[_0x5207f3('0x1b')](function(_0x1f58fe){const _0x38ca56=_0x5207f3;return _0x357be4[_0x38ca56('0x24')]=_0x1f58fe,_0x24e647[_0x38ca56('0x2d')]['includeAll']&&(_0x3defb2[_0x38ca56('0xb')]=[{'all':!![]}]),db['SugarcrmField']['findAll'](_0x3defb2);})[_0x5207f3('0x1b')](function(_0x4b207d){return _0x357be4['rows']=_0x4b207d,_0x357be4;})['then'](respondWithFilteredResult(_0x468dcd,_0x3defb2))[_0x5207f3('0x16')](handleError(_0x468dcd,null));},exports[_0x158eb9('0x1')]=function(_0x42fb27,_0x4c0185){const _0x2c5e19=_0x158eb9;let _0x5aede9={'raw':!![],'where':{'id':_0x42fb27[_0x2c5e19('0x13')]['id']}};const _0x41f3c6={};return _0x41f3c6[_0x2c5e19('0xf')]=_[_0x2c5e19('0x22')](db['SugarcrmField'][_0x2c5e19('0x1c')]),_0x41f3c6[_0x2c5e19('0x2d')]=_['keys'](_0x42fb27[_0x2c5e19('0x2d')]),_0x41f3c6['filters']=_['intersection'](_0x41f3c6[_0x2c5e19('0xf')],_0x41f3c6[_0x2c5e19('0x2d')]),_0x5aede9[_0x2c5e19('0x2a')]=_['intersection'](_0x41f3c6[_0x2c5e19('0xf')],qs['fields'](_0x42fb27[_0x2c5e19('0x2d')][_0x2c5e19('0x19')])),_0x5aede9[_0x2c5e19('0x2a')]=_0x5aede9['attributes']['length']?_0x5aede9[_0x2c5e19('0x2a')]:_0x41f3c6[_0x2c5e19('0xf')],_0x42fb27[_0x2c5e19('0x2d')][_0x2c5e19('0x15')]&&(_0x5aede9['include']=[{'all':!![]}]),_0x5aede9=_[_0x2c5e19('0x9')]({},_0x5aede9,_0x42fb27[_0x2c5e19('0x23')]),db[_0x2c5e19('0x29')]['findOne'](_0x5aede9)[_0x2c5e19('0x1b')](handleEntityNotFound(_0x4c0185,null))[_0x2c5e19('0x1b')](respondWithResult(_0x4c0185,null))[_0x2c5e19('0x16')](handleError(_0x4c0185,null));},exports[_0x158eb9('0x26')]=function(_0x2f4201,_0x292ad8){const _0x214691=_0x158eb9;return db[_0x214691('0x29')][_0x214691('0x26')](_0x2f4201[_0x214691('0x2e')],{})[_0x214691('0x1b')](respondWithResult(_0x292ad8,0xc9))[_0x214691('0x16')](handleError(_0x292ad8,null));},exports['update']=function(_0x4b3a65,_0x41a5a2){const _0x6bd24b=_0x158eb9;return _0x4b3a65[_0x6bd24b('0x2e')]['id']&&delete _0x4b3a65[_0x6bd24b('0x2e')]['id'],db[_0x6bd24b('0x29')][_0x6bd24b('0x28')]({'where':{'id':_0x4b3a65['params']['id']}})[_0x6bd24b('0x1b')](handleEntityNotFound(_0x41a5a2,null))[_0x6bd24b('0x1b')](saveUpdates(_0x4b3a65[_0x6bd24b('0x2e')],null))['then'](respondWithResult(_0x41a5a2,null))[_0x6bd24b('0x16')](handleError(_0x41a5a2,null));},exports[_0x158eb9('0x6')]=function(_0x514ee3,_0x2f8e83){const _0x437588=_0x158eb9;return db[_0x437588('0x29')]['findOne']({'where':{'id':_0x514ee3[_0x437588('0x13')]['id']}})[_0x437588('0x1b')](handleEntityNotFound(_0x2f8e83,null))[_0x437588('0x1b')](removeEntity(_0x2f8e83,null))[_0x437588('0x16')](handleError(_0x2f8e83,null));};
\ No newline at end of file