Built motion from commit b517aaa2a6638133380e4d135c64a80893061362. Version 3.0.0...
[motion-next.git] / server / api / intVtigerField / intVtigerField.controller.js
index 30b52ea..7e7645f 100644 (file)
@@ -1 +1 @@
-const a329_0x47b9=['set','like','where','name','end','intersection','destroy','params','../../components/parsers/qs','include','filter','sort','send','json','update','offset','../../config/logger','filters','type','map','create','attributes','query','lodash','then','options','VIRTUAL','catch','pick','index','findOne','stack','status','rawAttributes','order','limit','body','merge','error','count','model','includeAll','keys','VtigerField','length','rows','fields'];(function(_0x49a5ca,_0x47b9a5){const _0x420638=function(_0xd9ee3d){while(--_0xd9ee3d){_0x49a5ca['push'](_0x49a5ca['shift']());}};_0x420638(++_0x47b9a5);}(a329_0x47b9,0x17d));const a329_0x4206=function(_0x49a5ca,_0x47b9a5){_0x49a5ca=_0x49a5ca-0x0;let _0x420638=a329_0x47b9[_0x49a5ca];return _0x420638;};const _0x5bdb01=a329_0x4206;'use strict';const _=require(_0x5bdb01('0x12')),qs=require(_0x5bdb01('0x3')),logger=require(_0x5bdb01('0xb'))('api'),db=require('../../mysqldb')['db'],{Op}=require('sequelize');function respondWithResult(_0xd9ee3d,_0x2c34b9){return _0x2c34b9=_0x2c34b9||0xc8,function(_0x1f4fdd){const _0x2e54cb=a329_0x4206;if(_0x1f4fdd)return _0xd9ee3d[_0x2e54cb('0x1b')](_0x2c34b9)[_0x2e54cb('0x8')](_0x1f4fdd);};}function respondWithFilteredResult(_0x401635,_0x533365){return function(_0x167732){const _0x41a58f=a329_0x4206;if(_0x167732){const _0x10987c=_0x167732[_0x41a58f('0x22')],_0x575e89=_0x533365[_0x41a58f('0xa')];let _0x3d8590=_0x533365[_0x41a58f('0xa')]+_0x533365[_0x41a58f('0x1e')],_0x7c7246;return _0x3d8590>=_0x10987c?(_0x3d8590=_0x10987c,_0x7c7246=0xc8):_0x7c7246=0xce,_0x401635[_0x41a58f('0x1b')](_0x7c7246),_0x401635[_0x41a58f('0x2a')]('Content-Range',_0x575e89+'-'+_0x3d8590+'/'+_0x10987c)['json'](_0x167732);}return null;};}function saveUpdates(_0x4421e5){return function(_0x7549cb){const _0x55c8d0=a329_0x4206;if(_0x7549cb)return _0x7549cb[_0x55c8d0('0x9')](_0x4421e5)[_0x55c8d0('0x13')](function(_0x1a62fc){return _0x1a62fc;});return null;};}function removeEntity(_0x2cbfdb){return function(_0x20f39c){const _0xdff38d=a329_0x4206;if(_0x20f39c)return _0x20f39c[_0xdff38d('0x1')]()['then'](function(){const _0x5eaabf=_0xdff38d;_0x2cbfdb[_0x5eaabf('0x1b')](0xcc)[_0x5eaabf('0x2e')]();});};}function handleEntityNotFound(_0x34e113){return function(_0x2fdf00){return!_0x2fdf00&&_0x34e113['sendStatus'](0x194),_0x2fdf00;};}function handleError(_0x1dc1cc,_0x5a7234){return _0x5a7234=_0x5a7234||0x1f4,function(_0x2fb3fc){const _0x44cbb3=a329_0x4206;logger[_0x44cbb3('0x21')](_0x2fb3fc[_0x44cbb3('0x1a')]),_0x2fb3fc[_0x44cbb3('0x2d')]&&delete _0x2fb3fc[_0x44cbb3('0x2d')],_0x1dc1cc[_0x44cbb3('0x1b')](_0x5a7234)[_0x44cbb3('0x7')](_0x2fb3fc);};}exports[_0x5bdb01('0x18')]=function(_0x34308a,_0x2eaca8){const _0x3355d9=_0x5bdb01;let _0x2220aa={};const _0xec8363={},_0x13f174={'count':0x0,'rows':[]},_0x490986=_['map'](db['VtigerField']['rawAttributes'],function(_0x23e9e0){const _0x1173d4=a329_0x4206;return{'name':_0x23e9e0['fieldName'],'type':_0x23e9e0[_0x1173d4('0xd')]['key']};});_0xec8363[_0x3355d9('0x23')]=_[_0x3355d9('0xe')](_0x490986,_0x3355d9('0x2d')),_0xec8363['query']=_[_0x3355d9('0x25')](_0x34308a[_0x3355d9('0x11')]),_0xec8363[_0x3355d9('0xc')]=_[_0x3355d9('0x0')](_0xec8363['model'],_0xec8363[_0x3355d9('0x11')]),_0x2220aa['attributes']=_[_0x3355d9('0x0')](_0xec8363[_0x3355d9('0x23')],qs[_0x3355d9('0x29')](_0x34308a['query']['fields'])),_0x2220aa[_0x3355d9('0x10')]=_0x2220aa['attributes'][_0x3355d9('0x27')]?_0x2220aa[_0x3355d9('0x10')]:_0xec8363['model'];typeof _0x34308a[_0x3355d9('0x11')]['nolimit']==='undefined'&&(_0x2220aa['limit']=qs[_0x3355d9('0x1e')](_0x34308a[_0x3355d9('0x11')][_0x3355d9('0x1e')]),_0x2220aa['offset']=qs['offset'](_0x34308a[_0x3355d9('0x11')][_0x3355d9('0xa')]));_0x2220aa[_0x3355d9('0x1d')]=qs[_0x3355d9('0x6')](_0x34308a[_0x3355d9('0x11')][_0x3355d9('0x6')]),_0x2220aa[_0x3355d9('0x2c')]=qs[_0x3355d9('0xc')](_[_0x3355d9('0x17')](_0x34308a[_0x3355d9('0x11')],_0xec8363[_0x3355d9('0xc')]),_0x490986);_0x34308a[_0x3355d9('0x11')][_0x3355d9('0x5')]&&(_0x2220aa[_0x3355d9('0x2c')]=_[_0x3355d9('0x20')](_0x2220aa['where'],{[Op['or']]:_[_0x3355d9('0xe')](_0x490986,function(_0x4f24df){const _0x46ec93=_0x3355d9;if(_0x4f24df['type']!==_0x46ec93('0x15')){const _0x2a4aa0={};return _0x2a4aa0[_0x4f24df['name']]={[Op[_0x46ec93('0x2b')]]:'%'+_0x34308a[_0x46ec93('0x11')][_0x46ec93('0x5')]+'%'},_0x2a4aa0;}})}));_0x2220aa=_[_0x3355d9('0x20')]({},_0x2220aa,_0x34308a[_0x3355d9('0x14')]);const _0x423a03={'where':_0x2220aa['where']};return db[_0x3355d9('0x26')]['count'](_0x423a03)['then'](function(_0x5d3376){const _0x42412e=_0x3355d9;return _0x13f174['count']=_0x5d3376,_0x34308a[_0x42412e('0x11')][_0x42412e('0x24')]&&(_0x2220aa[_0x42412e('0x4')]=[{'all':!![]}]),db[_0x42412e('0x26')]['findAll'](_0x2220aa);})[_0x3355d9('0x13')](function(_0x2cd3e8){const _0x56d084=_0x3355d9;return _0x13f174[_0x56d084('0x28')]=_0x2cd3e8,_0x13f174;})[_0x3355d9('0x13')](respondWithFilteredResult(_0x2eaca8,_0x2220aa))['catch'](handleError(_0x2eaca8,null));},exports['show']=function(_0x1039ba,_0x52ad88){const _0x2c21bb=_0x5bdb01;let _0x3700df={'raw':!![],'where':{'id':_0x1039ba[_0x2c21bb('0x2')]['id']}};const _0xbd109c={};return _0xbd109c['model']=_[_0x2c21bb('0x25')](db[_0x2c21bb('0x26')][_0x2c21bb('0x1c')]),_0xbd109c[_0x2c21bb('0x11')]=_[_0x2c21bb('0x25')](_0x1039ba[_0x2c21bb('0x11')]),_0xbd109c[_0x2c21bb('0xc')]=_['intersection'](_0xbd109c[_0x2c21bb('0x23')],_0xbd109c[_0x2c21bb('0x11')]),_0x3700df[_0x2c21bb('0x10')]=_['intersection'](_0xbd109c[_0x2c21bb('0x23')],qs['fields'](_0x1039ba['query'][_0x2c21bb('0x29')])),_0x3700df[_0x2c21bb('0x10')]=_0x3700df[_0x2c21bb('0x10')][_0x2c21bb('0x27')]?_0x3700df[_0x2c21bb('0x10')]:_0xbd109c[_0x2c21bb('0x23')],_0x1039ba[_0x2c21bb('0x11')][_0x2c21bb('0x24')]&&(_0x3700df['include']=[{'all':!![]}]),_0x3700df=_['merge']({},_0x3700df,_0x1039ba[_0x2c21bb('0x14')]),db[_0x2c21bb('0x26')][_0x2c21bb('0x19')](_0x3700df)[_0x2c21bb('0x13')](handleEntityNotFound(_0x52ad88,null))[_0x2c21bb('0x13')](respondWithResult(_0x52ad88,null))['catch'](handleError(_0x52ad88,null));},exports[_0x5bdb01('0xf')]=function(_0x193692,_0x506390){const _0x110672=_0x5bdb01;return db[_0x110672('0x26')][_0x110672('0xf')](_0x193692['body'],{})['then'](respondWithResult(_0x506390,0xc9))[_0x110672('0x16')](handleError(_0x506390,null));},exports[_0x5bdb01('0x9')]=function(_0x5020d6,_0x1fbda0){const _0x38081b=_0x5bdb01;return _0x5020d6[_0x38081b('0x1f')]['id']&&delete _0x5020d6[_0x38081b('0x1f')]['id'],db[_0x38081b('0x26')][_0x38081b('0x19')]({'where':{'id':_0x5020d6[_0x38081b('0x2')]['id']}})['then'](handleEntityNotFound(_0x1fbda0,null))[_0x38081b('0x13')](saveUpdates(_0x5020d6[_0x38081b('0x1f')],null))['then'](respondWithResult(_0x1fbda0,null))[_0x38081b('0x16')](handleError(_0x1fbda0,null));},exports[_0x5bdb01('0x1')]=function(_0x1dc1b6,_0x455556){const _0x4b1e5d=_0x5bdb01;return db[_0x4b1e5d('0x26')][_0x4b1e5d('0x19')]({'where':{'id':_0x1dc1b6[_0x4b1e5d('0x2')]['id']}})[_0x4b1e5d('0x13')](handleEntityNotFound(_0x455556,null))[_0x4b1e5d('0x13')](removeEntity(_0x455556,null))[_0x4b1e5d('0x16')](handleError(_0x455556,null));};
\ No newline at end of file
+const a329_0x3ce4=['length','status','type','set','api','end','then','nolimit','include','VtigerField','VIRTUAL','update','rawAttributes','count','sort','offset','filter','includeAll','show','json','options','name','model','pick','body','destroy','attributes','merge','key','send','findAll','lodash','like','map','sendStatus','rows','index','limit','error','findOne','../../mysqldb','fields','stack','catch','keys','query','params','fieldName','intersection','where','create','filters'];(function(_0x3dbd10,_0x3ce491){const _0x332712=function(_0x43d8b0){while(--_0x43d8b0){_0x3dbd10['push'](_0x3dbd10['shift']());}};_0x332712(++_0x3ce491);}(a329_0x3ce4,0x92));const a329_0x3327=function(_0x3dbd10,_0x3ce491){_0x3dbd10=_0x3dbd10-0x0;let _0x332712=a329_0x3ce4[_0x3dbd10];return _0x332712;};const _0x109705=a329_0x3327;'use strict';const _=require(_0x109705('0x29')),qs=require('../../components/parsers/qs'),logger=require('../../config/logger')(_0x109705('0xe')),db=require(_0x109705('0x32'))['db'],{Op}=require('sequelize');function respondWithResult(_0x43d8b0,_0x453beb){return _0x453beb=_0x453beb||0xc8,function(_0x1e3083){const _0xb39cc4=a329_0x3327;if(_0x1e3083)return _0x43d8b0[_0xb39cc4('0xb')](_0x453beb)['json'](_0x1e3083);};}function respondWithFilteredResult(_0x5e297b,_0x3d88ba){return function(_0x386596){const _0x8b21ea=a329_0x3327;if(_0x386596){const _0xa17bfb=_0x386596[_0x8b21ea('0x17')],_0xd19a2=_0x3d88ba[_0x8b21ea('0x19')];let _0x55a3c8=_0x3d88ba['offset']+_0x3d88ba[_0x8b21ea('0x2f')],_0x2eea49;return _0x55a3c8>=_0xa17bfb?(_0x55a3c8=_0xa17bfb,_0x2eea49=0xc8):_0x2eea49=0xce,_0x5e297b[_0x8b21ea('0xb')](_0x2eea49),_0x5e297b[_0x8b21ea('0xd')]('Content-Range',_0xd19a2+'-'+_0x55a3c8+'/'+_0xa17bfb)[_0x8b21ea('0x1d')](_0x386596);}return null;};}function saveUpdates(_0x48d7ec){return function(_0xedd2fd){const _0x307564=a329_0x3327;if(_0xedd2fd)return _0xedd2fd[_0x307564('0x15')](_0x48d7ec)[_0x307564('0x10')](function(_0x44cb35){return _0x44cb35;});return null;};}function removeEntity(_0x492aa4){return function(_0x55cb3d){if(_0x55cb3d)return _0x55cb3d['destroy']()['then'](function(){const _0x305d69=a329_0x3327;_0x492aa4[_0x305d69('0xb')](0xcc)[_0x305d69('0xf')]();});};}function handleEntityNotFound(_0x43f603){return function(_0x286341){const _0x30b57d=a329_0x3327;return!_0x286341&&_0x43f603[_0x30b57d('0x2c')](0x194),_0x286341;};}function handleError(_0x397a1e,_0x4e6805){return _0x4e6805=_0x4e6805||0x1f4,function(_0x5dfec8){const _0x223fe5=a329_0x3327;logger[_0x223fe5('0x30')](_0x5dfec8[_0x223fe5('0x0')]),_0x5dfec8[_0x223fe5('0x1f')]&&delete _0x5dfec8[_0x223fe5('0x1f')],_0x397a1e[_0x223fe5('0xb')](_0x4e6805)[_0x223fe5('0x27')](_0x5dfec8);};}exports[_0x109705('0x2e')]=function(_0x5a659b,_0x330a89){const _0x2f0653=_0x109705;let _0x5c9402={};const _0x3e0aa3={},_0x3e9920={'count':0x0,'rows':[]},_0x3e64fa=_['map'](db[_0x2f0653('0x13')][_0x2f0653('0x16')],function(_0x3c709b){const _0x12bae7=_0x2f0653;return{'name':_0x3c709b[_0x12bae7('0x5')],'type':_0x3c709b[_0x12bae7('0xc')][_0x12bae7('0x26')]};});_0x3e0aa3[_0x2f0653('0x20')]=_[_0x2f0653('0x2b')](_0x3e64fa,'name'),_0x3e0aa3[_0x2f0653('0x3')]=_[_0x2f0653('0x2')](_0x5a659b['query']),_0x3e0aa3[_0x2f0653('0x9')]=_[_0x2f0653('0x6')](_0x3e0aa3['model'],_0x3e0aa3[_0x2f0653('0x3')]),_0x5c9402['attributes']=_[_0x2f0653('0x6')](_0x3e0aa3[_0x2f0653('0x20')],qs[_0x2f0653('0x33')](_0x5a659b[_0x2f0653('0x3')][_0x2f0653('0x33')])),_0x5c9402[_0x2f0653('0x24')]=_0x5c9402[_0x2f0653('0x24')][_0x2f0653('0xa')]?_0x5c9402[_0x2f0653('0x24')]:_0x3e0aa3['model'];typeof _0x5a659b['query'][_0x2f0653('0x11')]==='undefined'&&(_0x5c9402[_0x2f0653('0x2f')]=qs[_0x2f0653('0x2f')](_0x5a659b[_0x2f0653('0x3')]['limit']),_0x5c9402[_0x2f0653('0x19')]=qs['offset'](_0x5a659b[_0x2f0653('0x3')][_0x2f0653('0x19')]));_0x5c9402['order']=qs['sort'](_0x5a659b['query'][_0x2f0653('0x18')]),_0x5c9402[_0x2f0653('0x7')]=qs[_0x2f0653('0x9')](_[_0x2f0653('0x21')](_0x5a659b[_0x2f0653('0x3')],_0x3e0aa3[_0x2f0653('0x9')]),_0x3e64fa);_0x5a659b['query'][_0x2f0653('0x1a')]&&(_0x5c9402[_0x2f0653('0x7')]=_[_0x2f0653('0x25')](_0x5c9402[_0x2f0653('0x7')],{[Op['or']]:_[_0x2f0653('0x2b')](_0x3e64fa,function(_0x178b43){const _0x5a6816=_0x2f0653;if(_0x178b43[_0x5a6816('0xc')]!==_0x5a6816('0x14')){const _0x4c5fd1={};return _0x4c5fd1[_0x178b43[_0x5a6816('0x1f')]]={[Op[_0x5a6816('0x2a')]]:'%'+_0x5a659b[_0x5a6816('0x3')][_0x5a6816('0x1a')]+'%'},_0x4c5fd1;}})}));_0x5c9402=_[_0x2f0653('0x25')]({},_0x5c9402,_0x5a659b[_0x2f0653('0x1e')]);const _0xcbf88e={'where':_0x5c9402[_0x2f0653('0x7')]};return db[_0x2f0653('0x13')][_0x2f0653('0x17')](_0xcbf88e)['then'](function(_0x46440b){const _0x456963=_0x2f0653;return _0x3e9920['count']=_0x46440b,_0x5a659b[_0x456963('0x3')]['includeAll']&&(_0x5c9402[_0x456963('0x12')]=[{'all':!![]}]),db[_0x456963('0x13')][_0x456963('0x28')](_0x5c9402);})['then'](function(_0x9eb2c1){const _0x177fa6=_0x2f0653;return _0x3e9920[_0x177fa6('0x2d')]=_0x9eb2c1,_0x3e9920;})[_0x2f0653('0x10')](respondWithFilteredResult(_0x330a89,_0x5c9402))[_0x2f0653('0x1')](handleError(_0x330a89,null));},exports[_0x109705('0x1c')]=function(_0x13bc31,_0x527507){const _0x5ef3ac=_0x109705;let _0x3b3d37={'raw':!![],'where':{'id':_0x13bc31[_0x5ef3ac('0x4')]['id']}};const _0x132660={};return _0x132660[_0x5ef3ac('0x20')]=_['keys'](db[_0x5ef3ac('0x13')][_0x5ef3ac('0x16')]),_0x132660[_0x5ef3ac('0x3')]=_[_0x5ef3ac('0x2')](_0x13bc31['query']),_0x132660[_0x5ef3ac('0x9')]=_[_0x5ef3ac('0x6')](_0x132660[_0x5ef3ac('0x20')],_0x132660[_0x5ef3ac('0x3')]),_0x3b3d37[_0x5ef3ac('0x24')]=_['intersection'](_0x132660[_0x5ef3ac('0x20')],qs[_0x5ef3ac('0x33')](_0x13bc31[_0x5ef3ac('0x3')][_0x5ef3ac('0x33')])),_0x3b3d37['attributes']=_0x3b3d37[_0x5ef3ac('0x24')]['length']?_0x3b3d37[_0x5ef3ac('0x24')]:_0x132660['model'],_0x13bc31['query'][_0x5ef3ac('0x1b')]&&(_0x3b3d37['include']=[{'all':!![]}]),_0x3b3d37=_[_0x5ef3ac('0x25')]({},_0x3b3d37,_0x13bc31[_0x5ef3ac('0x1e')]),db['VtigerField']['findOne'](_0x3b3d37)[_0x5ef3ac('0x10')](handleEntityNotFound(_0x527507,null))[_0x5ef3ac('0x10')](respondWithResult(_0x527507,null))[_0x5ef3ac('0x1')](handleError(_0x527507,null));},exports[_0x109705('0x8')]=function(_0x5b4010,_0x2f4475){const _0x4b9918=_0x109705;return db[_0x4b9918('0x13')]['create'](_0x5b4010[_0x4b9918('0x22')],{})['then'](respondWithResult(_0x2f4475,0xc9))[_0x4b9918('0x1')](handleError(_0x2f4475,null));},exports[_0x109705('0x15')]=function(_0xfc051d,_0x2bbd51){const _0x1a505a=_0x109705;return _0xfc051d[_0x1a505a('0x22')]['id']&&delete _0xfc051d[_0x1a505a('0x22')]['id'],db[_0x1a505a('0x13')][_0x1a505a('0x31')]({'where':{'id':_0xfc051d[_0x1a505a('0x4')]['id']}})[_0x1a505a('0x10')](handleEntityNotFound(_0x2bbd51,null))[_0x1a505a('0x10')](saveUpdates(_0xfc051d['body'],null))['then'](respondWithResult(_0x2bbd51,null))[_0x1a505a('0x1')](handleError(_0x2bbd51,null));},exports[_0x109705('0x23')]=function(_0x59ea9a,_0x3a8beb){const _0x355179=_0x109705;return db['VtigerField']['findOne']({'where':{'id':_0x59ea9a[_0x355179('0x4')]['id']}})[_0x355179('0x10')](handleEntityNotFound(_0x3a8beb,null))[_0x355179('0x10')](removeEntity(_0x3a8beb,null))[_0x355179('0x1')](handleError(_0x3a8beb,null));};
\ No newline at end of file