Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / intServicenowField / intServicenowField.controller.js
index e86dfc1..18a0821 100644 (file)
@@ -1 +1 @@
-const a303_0x19b7=['length','includeAll','sort','create','status','intersection','undefined','then','rows','merge','set','options','where','like','body','type','destroy','update','fieldName','count','offset','include','filters','catch','findOne','keys','order','filter','VIRTUAL','limit','query','show','sequelize','end','map','lodash','../../components/parsers/qs','attributes','nolimit','rawAttributes','params','model','ServicenowField','json','findAll','name','key','fields','pick'];(function(_0x480132,_0x19b742){const _0x3a50d1=function(_0x4b210d){while(--_0x4b210d){_0x480132['push'](_0x480132['shift']());}};_0x3a50d1(++_0x19b742);}(a303_0x19b7,0x7e));const a303_0x3a50=function(_0x480132,_0x19b742){_0x480132=_0x480132-0x0;let _0x3a50d1=a303_0x19b7[_0x480132];return _0x3a50d1;};const _0x5ba1a6=a303_0x3a50;'use strict';const _=require(_0x5ba1a6('0x7')),qs=require(_0x5ba1a6('0x8')),logger=require('../../config/logger')('api'),db=require('../../mysqldb')['db'],{Op}=require(_0x5ba1a6('0x4'));function respondWithResult(_0x4b210d,_0x42aa30){return _0x42aa30=_0x42aa30||0xc8,function(_0x3997c3){const _0x53aedb=a303_0x3a50;if(_0x3997c3)return _0x4b210d[_0x53aedb('0x19')](_0x42aa30)[_0x53aedb('0xf')](_0x3997c3);};}function respondWithFilteredResult(_0x3b9634,_0x3196c3){return function(_0x1712cf){const _0x5400d3=a303_0x3a50;if(_0x1712cf){const _0x38d6ae=_0x1712cf['count'],_0x1b4596=_0x3196c3[_0x5400d3('0x29')];let _0x49e9d5=_0x3196c3[_0x5400d3('0x29')]+_0x3196c3[_0x5400d3('0x1')],_0x1242ee;return _0x49e9d5>=_0x38d6ae?(_0x49e9d5=_0x38d6ae,_0x1242ee=0xc8):_0x1242ee=0xce,_0x3b9634[_0x5400d3('0x19')](_0x1242ee),_0x3b9634[_0x5400d3('0x1f')]('Content-Range',_0x1b4596+'-'+_0x49e9d5+'/'+_0x38d6ae)['json'](_0x1712cf);}return null;};}function saveUpdates(_0x16e685){return function(_0x515dfe){const _0x5a8195=a303_0x3a50;if(_0x515dfe)return _0x515dfe[_0x5a8195('0x26')](_0x16e685)[_0x5a8195('0x1c')](function(_0x4c03a0){return _0x4c03a0;});return null;};}function removeEntity(_0x3e5814){return function(_0x59444f){const _0x1f808f=a303_0x3a50;if(_0x59444f)return _0x59444f[_0x1f808f('0x25')]()[_0x1f808f('0x1c')](function(){const _0x5e7e86=_0x1f808f;_0x3e5814[_0x5e7e86('0x19')](0xcc)[_0x5e7e86('0x5')]();});};}function handleEntityNotFound(_0xbb9422){return function(_0x2b149c){return!_0x2b149c&&_0xbb9422['sendStatus'](0x194),_0x2b149c;};}function handleError(_0x1cf3ee,_0x31d6f2){return _0x31d6f2=_0x31d6f2||0x1f4,function(_0x48128b){const _0x2aa615=a303_0x3a50;logger['error'](_0x48128b['stack']),_0x48128b[_0x2aa615('0x11')]&&delete _0x48128b[_0x2aa615('0x11')],_0x1cf3ee[_0x2aa615('0x19')](_0x31d6f2)['send'](_0x48128b);};}exports['index']=function(_0x4c800d,_0x29d91c){const _0x4f5502=_0x5ba1a6;let _0x545bf5={};const _0x473f82={},_0x3397ae={'count':0x0,'rows':[]},_0x377aa5=_[_0x4f5502('0x6')](db[_0x4f5502('0xe')][_0x4f5502('0xb')],function(_0x820a3e){const _0x10e2f3=_0x4f5502;return{'name':_0x820a3e[_0x10e2f3('0x27')],'type':_0x820a3e[_0x10e2f3('0x24')][_0x10e2f3('0x12')]};});_0x473f82[_0x4f5502('0xd')]=_[_0x4f5502('0x6')](_0x377aa5,_0x4f5502('0x11')),_0x473f82['query']=_[_0x4f5502('0x2e')](_0x4c800d[_0x4f5502('0x2')]),_0x473f82['filters']=_['intersection'](_0x473f82[_0x4f5502('0xd')],_0x473f82[_0x4f5502('0x2')]),_0x545bf5[_0x4f5502('0x9')]=_[_0x4f5502('0x1a')](_0x473f82[_0x4f5502('0xd')],qs[_0x4f5502('0x13')](_0x4c800d[_0x4f5502('0x2')][_0x4f5502('0x13')])),_0x545bf5[_0x4f5502('0x9')]=_0x545bf5['attributes']['length']?_0x545bf5[_0x4f5502('0x9')]:_0x473f82[_0x4f5502('0xd')];typeof _0x4c800d[_0x4f5502('0x2')][_0x4f5502('0xa')]===_0x4f5502('0x1b')&&(_0x545bf5['limit']=qs[_0x4f5502('0x1')](_0x4c800d[_0x4f5502('0x2')][_0x4f5502('0x1')]),_0x545bf5['offset']=qs[_0x4f5502('0x29')](_0x4c800d[_0x4f5502('0x2')][_0x4f5502('0x29')]));_0x545bf5[_0x4f5502('0x2f')]=qs[_0x4f5502('0x17')](_0x4c800d[_0x4f5502('0x2')][_0x4f5502('0x17')]),_0x545bf5[_0x4f5502('0x21')]=qs[_0x4f5502('0x2b')](_[_0x4f5502('0x14')](_0x4c800d[_0x4f5502('0x2')],_0x473f82['filters']),_0x377aa5);_0x4c800d[_0x4f5502('0x2')][_0x4f5502('0x30')]&&(_0x545bf5[_0x4f5502('0x21')]=_[_0x4f5502('0x1e')](_0x545bf5[_0x4f5502('0x21')],{[Op['or']]:_[_0x4f5502('0x6')](_0x377aa5,function(_0x22a178){const _0x40a86a=_0x4f5502;if(_0x22a178[_0x40a86a('0x24')]!==_0x40a86a('0x0')){const _0xb617dd={};return _0xb617dd[_0x22a178[_0x40a86a('0x11')]]={[Op[_0x40a86a('0x22')]]:'%'+_0x4c800d[_0x40a86a('0x2')][_0x40a86a('0x30')]+'%'},_0xb617dd;}})}));_0x545bf5=_[_0x4f5502('0x1e')]({},_0x545bf5,_0x4c800d[_0x4f5502('0x20')]);const _0x4d287a={'where':_0x545bf5[_0x4f5502('0x21')]};return db['ServicenowField'][_0x4f5502('0x28')](_0x4d287a)[_0x4f5502('0x1c')](function(_0x256ccf){const _0x367c9d=_0x4f5502;return _0x3397ae[_0x367c9d('0x28')]=_0x256ccf,_0x4c800d[_0x367c9d('0x2')][_0x367c9d('0x16')]&&(_0x545bf5[_0x367c9d('0x2a')]=[{'all':!![]}]),db[_0x367c9d('0xe')][_0x367c9d('0x10')](_0x545bf5);})[_0x4f5502('0x1c')](function(_0x14f6b3){const _0x205736=_0x4f5502;return _0x3397ae[_0x205736('0x1d')]=_0x14f6b3,_0x3397ae;})[_0x4f5502('0x1c')](respondWithFilteredResult(_0x29d91c,_0x545bf5))[_0x4f5502('0x2c')](handleError(_0x29d91c,null));},exports[_0x5ba1a6('0x3')]=function(_0x31111a,_0x3305c7){const _0x10782d=_0x5ba1a6;let _0x3fcb73={'raw':!![],'where':{'id':_0x31111a[_0x10782d('0xc')]['id']}};const _0x493a52={};return _0x493a52[_0x10782d('0xd')]=_['keys'](db['ServicenowField'][_0x10782d('0xb')]),_0x493a52[_0x10782d('0x2')]=_['keys'](_0x31111a[_0x10782d('0x2')]),_0x493a52['filters']=_[_0x10782d('0x1a')](_0x493a52[_0x10782d('0xd')],_0x493a52[_0x10782d('0x2')]),_0x3fcb73[_0x10782d('0x9')]=_[_0x10782d('0x1a')](_0x493a52[_0x10782d('0xd')],qs['fields'](_0x31111a[_0x10782d('0x2')]['fields'])),_0x3fcb73['attributes']=_0x3fcb73[_0x10782d('0x9')][_0x10782d('0x15')]?_0x3fcb73[_0x10782d('0x9')]:_0x493a52[_0x10782d('0xd')],_0x31111a['query'][_0x10782d('0x16')]&&(_0x3fcb73[_0x10782d('0x2a')]=[{'all':!![]}]),_0x3fcb73=_[_0x10782d('0x1e')]({},_0x3fcb73,_0x31111a[_0x10782d('0x20')]),db[_0x10782d('0xe')][_0x10782d('0x2d')](_0x3fcb73)[_0x10782d('0x1c')](handleEntityNotFound(_0x3305c7,null))[_0x10782d('0x1c')](respondWithResult(_0x3305c7,null))[_0x10782d('0x2c')](handleError(_0x3305c7,null));},exports[_0x5ba1a6('0x18')]=function(_0x3d4931,_0x2aa40a){const _0x105c93=_0x5ba1a6;return db['ServicenowField'][_0x105c93('0x18')](_0x3d4931[_0x105c93('0x23')],{})[_0x105c93('0x1c')](respondWithResult(_0x2aa40a,0xc9))[_0x105c93('0x2c')](handleError(_0x2aa40a,null));},exports[_0x5ba1a6('0x26')]=function(_0x5e5095,_0x20a81c){const _0x44fccf=_0x5ba1a6;return _0x5e5095[_0x44fccf('0x23')]['id']&&delete _0x5e5095[_0x44fccf('0x23')]['id'],db[_0x44fccf('0xe')][_0x44fccf('0x2d')]({'where':{'id':_0x5e5095['params']['id']}})['then'](handleEntityNotFound(_0x20a81c,null))[_0x44fccf('0x1c')](saveUpdates(_0x5e5095[_0x44fccf('0x23')],null))[_0x44fccf('0x1c')](respondWithResult(_0x20a81c,null))['catch'](handleError(_0x20a81c,null));},exports['destroy']=function(_0x176d04,_0x42ede1){const _0x12bbd=_0x5ba1a6;return db[_0x12bbd('0xe')][_0x12bbd('0x2d')]({'where':{'id':_0x176d04[_0x12bbd('0xc')]['id']}})['then'](handleEntityNotFound(_0x42ede1,null))['then'](removeEntity(_0x42ede1,null))[_0x12bbd('0x2c')](handleError(_0x42ede1,null));};
\ No newline at end of file
+const a303_0x5980=['name','fieldName','params','VIRTUAL','count','length','error','map','filters','json','limit','update','where','api','destroy','order','includeAll','findAll','intersection','end','sort','../../mysqldb','keys','lodash','ServicenowField','attributes','type','merge','offset','create','model','rawAttributes','../../components/parsers/qs','include','rows','fields','pick','sendStatus','body','undefined','like','query','catch','status','key','filter','then'];(function(_0x251a2a,_0x598022){const _0x1eb97e=function(_0x2d41e6){while(--_0x2d41e6){_0x251a2a['push'](_0x251a2a['shift']());}};_0x1eb97e(++_0x598022);}(a303_0x5980,0xaa));const a303_0x1eb9=function(_0x251a2a,_0x598022){_0x251a2a=_0x251a2a-0x0;let _0x1eb97e=a303_0x5980[_0x251a2a];return _0x1eb97e;};const _0x4a48c4=a303_0x1eb9;'use strict';const _=require(_0x4a48c4('0x29')),qs=require(_0x4a48c4('0x3')),logger=require('../../config/logger')(_0x4a48c4('0x1f')),db=require(_0x4a48c4('0x27'))['db'],{Op}=require('sequelize');function respondWithResult(_0x2d41e6,_0x16351f){return _0x16351f=_0x16351f||0xc8,function(_0x5d1c08){if(_0x5d1c08)return _0x2d41e6['status'](_0x16351f)['json'](_0x5d1c08);};}function respondWithFilteredResult(_0x3cbc2a,_0x1914fa){return function(_0x3798d1){const _0x38d2ae=a303_0x1eb9;if(_0x3798d1){const _0xacffdc=_0x3798d1['count'],_0x1764d2=_0x1914fa[_0x38d2ae('0x2e')];let _0xc803c6=_0x1914fa[_0x38d2ae('0x2e')]+_0x1914fa['limit'],_0x5b6ae3;return _0xc803c6>=_0xacffdc?(_0xc803c6=_0xacffdc,_0x5b6ae3=0xc8):_0x5b6ae3=0xce,_0x3cbc2a[_0x38d2ae('0xe')](_0x5b6ae3),_0x3cbc2a['set']('Content-Range',_0x1764d2+'-'+_0xc803c6+'/'+_0xacffdc)[_0x38d2ae('0x1b')](_0x3798d1);}return null;};}function saveUpdates(_0x245e5e){return function(_0x3e0c7e){const _0x57ec05=a303_0x1eb9;if(_0x3e0c7e)return _0x3e0c7e['update'](_0x245e5e)[_0x57ec05('0x11')](function(_0x21b4cd){return _0x21b4cd;});return null;};}function removeEntity(_0x1c6135){return function(_0x34305a){const _0x53f25d=a303_0x1eb9;if(_0x34305a)return _0x34305a[_0x53f25d('0x20')]()[_0x53f25d('0x11')](function(){const _0x2527a5=_0x53f25d;_0x1c6135[_0x2527a5('0xe')](0xcc)[_0x2527a5('0x25')]();});};}function handleEntityNotFound(_0x4b7139){return function(_0x262371){const _0x4f62da=a303_0x1eb9;return!_0x262371&&_0x4b7139[_0x4f62da('0x8')](0x194),_0x262371;};}function handleError(_0x18db33,_0x1af605){return _0x1af605=_0x1af605||0x1f4,function(_0x2ff3a8){const _0x6f9759=a303_0x1eb9;logger[_0x6f9759('0x18')](_0x2ff3a8['stack']),_0x2ff3a8[_0x6f9759('0x12')]&&delete _0x2ff3a8[_0x6f9759('0x12')],_0x18db33['status'](_0x1af605)['send'](_0x2ff3a8);};}exports['index']=function(_0x3d3eaa,_0x38d0df){const _0x16f74a=_0x4a48c4;let _0x4d7ea7={};const _0x4dd351={},_0x1e6b6a={'count':0x0,'rows':[]},_0x890edf=_[_0x16f74a('0x19')](db[_0x16f74a('0x2a')][_0x16f74a('0x2')],function(_0x32dfa1){const _0x39daf2=_0x16f74a;return{'name':_0x32dfa1[_0x39daf2('0x13')],'type':_0x32dfa1[_0x39daf2('0x2c')][_0x39daf2('0xf')]};});_0x4dd351[_0x16f74a('0x1')]=_[_0x16f74a('0x19')](_0x890edf,_0x16f74a('0x12')),_0x4dd351[_0x16f74a('0xc')]=_[_0x16f74a('0x28')](_0x3d3eaa[_0x16f74a('0xc')]),_0x4dd351[_0x16f74a('0x1a')]=_[_0x16f74a('0x24')](_0x4dd351['model'],_0x4dd351['query']),_0x4d7ea7[_0x16f74a('0x2b')]=_['intersection'](_0x4dd351[_0x16f74a('0x1')],qs[_0x16f74a('0x6')](_0x3d3eaa[_0x16f74a('0xc')]['fields'])),_0x4d7ea7[_0x16f74a('0x2b')]=_0x4d7ea7[_0x16f74a('0x2b')][_0x16f74a('0x17')]?_0x4d7ea7['attributes']:_0x4dd351[_0x16f74a('0x1')];typeof _0x3d3eaa[_0x16f74a('0xc')]['nolimit']===_0x16f74a('0xa')&&(_0x4d7ea7['limit']=qs[_0x16f74a('0x1c')](_0x3d3eaa['query'][_0x16f74a('0x1c')]),_0x4d7ea7[_0x16f74a('0x2e')]=qs['offset'](_0x3d3eaa[_0x16f74a('0xc')][_0x16f74a('0x2e')]));_0x4d7ea7[_0x16f74a('0x21')]=qs[_0x16f74a('0x26')](_0x3d3eaa[_0x16f74a('0xc')]['sort']),_0x4d7ea7[_0x16f74a('0x1e')]=qs[_0x16f74a('0x1a')](_[_0x16f74a('0x7')](_0x3d3eaa[_0x16f74a('0xc')],_0x4dd351[_0x16f74a('0x1a')]),_0x890edf);_0x3d3eaa['query'][_0x16f74a('0x10')]&&(_0x4d7ea7['where']=_['merge'](_0x4d7ea7[_0x16f74a('0x1e')],{[Op['or']]:_['map'](_0x890edf,function(_0x2bafb4){const _0x3fc770=_0x16f74a;if(_0x2bafb4['type']!==_0x3fc770('0x15')){const _0x21f023={};return _0x21f023[_0x2bafb4['name']]={[Op[_0x3fc770('0xb')]]:'%'+_0x3d3eaa['query']['filter']+'%'},_0x21f023;}})}));_0x4d7ea7=_[_0x16f74a('0x2d')]({},_0x4d7ea7,_0x3d3eaa['options']);const _0x323a81={'where':_0x4d7ea7[_0x16f74a('0x1e')]};return db['ServicenowField'][_0x16f74a('0x16')](_0x323a81)['then'](function(_0x18b65c){const _0x3fd325=_0x16f74a;return _0x1e6b6a[_0x3fd325('0x16')]=_0x18b65c,_0x3d3eaa[_0x3fd325('0xc')][_0x3fd325('0x22')]&&(_0x4d7ea7[_0x3fd325('0x4')]=[{'all':!![]}]),db[_0x3fd325('0x2a')][_0x3fd325('0x23')](_0x4d7ea7);})[_0x16f74a('0x11')](function(_0x2d2469){const _0x23775c=_0x16f74a;return _0x1e6b6a[_0x23775c('0x5')]=_0x2d2469,_0x1e6b6a;})[_0x16f74a('0x11')](respondWithFilteredResult(_0x38d0df,_0x4d7ea7))[_0x16f74a('0xd')](handleError(_0x38d0df,null));},exports['show']=function(_0x5f1967,_0x7ad2c3){const _0xd73372=_0x4a48c4;let _0x114828={'raw':!![],'where':{'id':_0x5f1967[_0xd73372('0x14')]['id']}};const _0x31ed6b={};return _0x31ed6b[_0xd73372('0x1')]=_['keys'](db[_0xd73372('0x2a')]['rawAttributes']),_0x31ed6b['query']=_['keys'](_0x5f1967['query']),_0x31ed6b[_0xd73372('0x1a')]=_[_0xd73372('0x24')](_0x31ed6b[_0xd73372('0x1')],_0x31ed6b[_0xd73372('0xc')]),_0x114828[_0xd73372('0x2b')]=_[_0xd73372('0x24')](_0x31ed6b['model'],qs[_0xd73372('0x6')](_0x5f1967[_0xd73372('0xc')][_0xd73372('0x6')])),_0x114828[_0xd73372('0x2b')]=_0x114828[_0xd73372('0x2b')][_0xd73372('0x17')]?_0x114828['attributes']:_0x31ed6b[_0xd73372('0x1')],_0x5f1967[_0xd73372('0xc')][_0xd73372('0x22')]&&(_0x114828[_0xd73372('0x4')]=[{'all':!![]}]),_0x114828=_[_0xd73372('0x2d')]({},_0x114828,_0x5f1967['options']),db['ServicenowField']['findOne'](_0x114828)[_0xd73372('0x11')](handleEntityNotFound(_0x7ad2c3,null))[_0xd73372('0x11')](respondWithResult(_0x7ad2c3,null))['catch'](handleError(_0x7ad2c3,null));},exports[_0x4a48c4('0x0')]=function(_0x1f51fe,_0x414792){const _0x39700b=_0x4a48c4;return db[_0x39700b('0x2a')]['create'](_0x1f51fe[_0x39700b('0x9')],{})['then'](respondWithResult(_0x414792,0xc9))['catch'](handleError(_0x414792,null));},exports[_0x4a48c4('0x1d')]=function(_0x2f7cd9,_0x24e55f){const _0xe47988=_0x4a48c4;return _0x2f7cd9[_0xe47988('0x9')]['id']&&delete _0x2f7cd9['body']['id'],db[_0xe47988('0x2a')]['findOne']({'where':{'id':_0x2f7cd9[_0xe47988('0x14')]['id']}})[_0xe47988('0x11')](handleEntityNotFound(_0x24e55f,null))[_0xe47988('0x11')](saveUpdates(_0x2f7cd9[_0xe47988('0x9')],null))['then'](respondWithResult(_0x24e55f,null))[_0xe47988('0xd')](handleError(_0x24e55f,null));},exports[_0x4a48c4('0x20')]=function(_0x20f40f,_0x5bb5c6){const _0x425d3b=_0x4a48c4;return db['ServicenowField']['findOne']({'where':{'id':_0x20f40f[_0x425d3b('0x14')]['id']}})[_0x425d3b('0x11')](handleEntityNotFound(_0x5bb5c6,null))[_0x425d3b('0x11')](removeEntity(_0x5bb5c6,null))[_0x425d3b('0xd')](handleError(_0x5bb5c6,null));};
\ No newline at end of file