Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / intDynamics365Field / intDynamics365Field.controller.js
index 7c39d1d..ad0c714 100644 (file)
@@ -1 +1 @@
-const a251_0x1663=['merge','sequelize','destroy','includeAll','sendStatus','include','rawAttributes','like','type','../../components/parsers/qs','VIRTUAL','stack','limit','count','body','model','nolimit','key','../../mysqldb','show','filter','undefined','name','rows','api','set','length','pick','index','findAll','attributes','update','fieldName','keys','create','status','send','filters','query','Content-Range','params','options','fields','lodash','then','json','findOne','where','offset','sort','catch','intersection','map','Dynamics365Field'];(function(_0x5ae103,_0x16631c){const _0x3cd11a=function(_0x55649f){while(--_0x55649f){_0x5ae103['push'](_0x5ae103['shift']());}};_0x3cd11a(++_0x16631c);}(a251_0x1663,0x1ac));const a251_0x3cd1=function(_0x5ae103,_0x16631c){_0x5ae103=_0x5ae103-0x0;let _0x3cd11a=a251_0x1663[_0x5ae103];return _0x3cd11a;};const _0x2e0c7c=a251_0x3cd1;'use strict';const _=require(_0x2e0c7c('0x2f')),qs=require(_0x2e0c7c('0xd')),logger=require('../../config/logger')(_0x2e0c7c('0x1c')),db=require(_0x2e0c7c('0x16'))['db'],{Op}=require(_0x2e0c7c('0x5'));function respondWithResult(_0x55649f,_0x4afd28){return _0x4afd28=_0x4afd28||0xc8,function(_0x1bfa01){const _0x3a4ee0=a251_0x3cd1;if(_0x1bfa01)return _0x55649f[_0x3a4ee0('0x27')](_0x4afd28)[_0x3a4ee0('0x31')](_0x1bfa01);};}function respondWithFilteredResult(_0x229069,_0x3c45d8){return function(_0x4a8585){const _0x1e2b92=a251_0x3cd1;if(_0x4a8585){const _0x39dcfd=_0x4a8585[_0x1e2b92('0x11')],_0x42aa71=_0x3c45d8['offset'];let _0x291b52=_0x3c45d8[_0x1e2b92('0x34')]+_0x3c45d8[_0x1e2b92('0x10')],_0x29757a;return _0x291b52>=_0x39dcfd?(_0x291b52=_0x39dcfd,_0x29757a=0xc8):_0x29757a=0xce,_0x229069['status'](_0x29757a),_0x229069[_0x1e2b92('0x1d')](_0x1e2b92('0x2b'),_0x42aa71+'-'+_0x291b52+'/'+_0x39dcfd)[_0x1e2b92('0x31')](_0x4a8585);}return null;};}function saveUpdates(_0xed6dc1){return function(_0x2cf6d3){const _0x254dd5=a251_0x3cd1;if(_0x2cf6d3)return _0x2cf6d3[_0x254dd5('0x23')](_0xed6dc1)[_0x254dd5('0x30')](function(_0x2d68ad){return _0x2d68ad;});return null;};}function removeEntity(_0x434d72){return function(_0x28737e){if(_0x28737e)return _0x28737e['destroy']()['then'](function(){const _0x54012b=a251_0x3cd1;_0x434d72[_0x54012b('0x27')](0xcc)['end']();});};}function handleEntityNotFound(_0x2db1fe){return function(_0x8d0179){const _0x550a60=a251_0x3cd1;return!_0x8d0179&&_0x2db1fe[_0x550a60('0x8')](0x194),_0x8d0179;};}function handleError(_0x2194b2,_0x289d32){return _0x289d32=_0x289d32||0x1f4,function(_0x4c45a0){const _0x12a441=a251_0x3cd1;logger['error'](_0x4c45a0[_0x12a441('0xf')]),_0x4c45a0[_0x12a441('0x1a')]&&delete _0x4c45a0[_0x12a441('0x1a')],_0x2194b2[_0x12a441('0x27')](_0x289d32)[_0x12a441('0x28')](_0x4c45a0);};}exports[_0x2e0c7c('0x20')]=function(_0xe42ea,_0x54f5ec){const _0x433d78=_0x2e0c7c;let _0x5418bf={};const _0x968553={},_0x6a8a81={'count':0x0,'rows':[]},_0x5ce219=_[_0x433d78('0x2')](db['Dynamics365Field']['rawAttributes'],function(_0x5cd6b3){const _0x545299=_0x433d78;return{'name':_0x5cd6b3[_0x545299('0x24')],'type':_0x5cd6b3[_0x545299('0xc')][_0x545299('0x15')]};});_0x968553['model']=_[_0x433d78('0x2')](_0x5ce219,_0x433d78('0x1a')),_0x968553[_0x433d78('0x2a')]=_[_0x433d78('0x25')](_0xe42ea[_0x433d78('0x2a')]),_0x968553[_0x433d78('0x29')]=_[_0x433d78('0x1')](_0x968553['model'],_0x968553[_0x433d78('0x2a')]),_0x5418bf[_0x433d78('0x22')]=_[_0x433d78('0x1')](_0x968553[_0x433d78('0x13')],qs[_0x433d78('0x2e')](_0xe42ea[_0x433d78('0x2a')][_0x433d78('0x2e')])),_0x5418bf[_0x433d78('0x22')]=_0x5418bf[_0x433d78('0x22')][_0x433d78('0x1e')]?_0x5418bf['attributes']:_0x968553[_0x433d78('0x13')];typeof _0xe42ea[_0x433d78('0x2a')][_0x433d78('0x14')]===_0x433d78('0x19')&&(_0x5418bf[_0x433d78('0x10')]=qs[_0x433d78('0x10')](_0xe42ea[_0x433d78('0x2a')][_0x433d78('0x10')]),_0x5418bf[_0x433d78('0x34')]=qs[_0x433d78('0x34')](_0xe42ea[_0x433d78('0x2a')]['offset']));_0x5418bf['order']=qs[_0x433d78('0x35')](_0xe42ea['query']['sort']),_0x5418bf['where']=qs[_0x433d78('0x29')](_[_0x433d78('0x1f')](_0xe42ea[_0x433d78('0x2a')],_0x968553[_0x433d78('0x29')]),_0x5ce219);_0xe42ea[_0x433d78('0x2a')][_0x433d78('0x18')]&&(_0x5418bf[_0x433d78('0x33')]=_[_0x433d78('0x4')](_0x5418bf['where'],{[Op['or']]:_[_0x433d78('0x2')](_0x5ce219,function(_0x41de4f){const _0x5c3689=_0x433d78;if(_0x41de4f[_0x5c3689('0xc')]!==_0x5c3689('0xe')){const _0x24df86={};return _0x24df86[_0x41de4f['name']]={[Op[_0x5c3689('0xb')]]:'%'+_0xe42ea[_0x5c3689('0x2a')]['filter']+'%'},_0x24df86;}})}));_0x5418bf=_[_0x433d78('0x4')]({},_0x5418bf,_0xe42ea[_0x433d78('0x2d')]);const _0xfceb97={'where':_0x5418bf[_0x433d78('0x33')]};return db['Dynamics365Field'][_0x433d78('0x11')](_0xfceb97)[_0x433d78('0x30')](function(_0xda4d3){const _0x3e5fa0=_0x433d78;return _0x6a8a81['count']=_0xda4d3,_0xe42ea[_0x3e5fa0('0x2a')][_0x3e5fa0('0x7')]&&(_0x5418bf['include']=[{'all':!![]}]),db[_0x3e5fa0('0x3')][_0x3e5fa0('0x21')](_0x5418bf);})[_0x433d78('0x30')](function(_0x2d7616){const _0x2a2221=_0x433d78;return _0x6a8a81[_0x2a2221('0x1b')]=_0x2d7616,_0x6a8a81;})[_0x433d78('0x30')](respondWithFilteredResult(_0x54f5ec,_0x5418bf))[_0x433d78('0x0')](handleError(_0x54f5ec,null));},exports[_0x2e0c7c('0x17')]=function(_0x38fb56,_0x2c552a){const _0x49ce06=_0x2e0c7c;let _0x32b9a1={'raw':!![],'where':{'id':_0x38fb56[_0x49ce06('0x2c')]['id']}};const _0x35f804={};return _0x35f804[_0x49ce06('0x13')]=_[_0x49ce06('0x25')](db[_0x49ce06('0x3')][_0x49ce06('0xa')]),_0x35f804[_0x49ce06('0x2a')]=_[_0x49ce06('0x25')](_0x38fb56[_0x49ce06('0x2a')]),_0x35f804['filters']=_[_0x49ce06('0x1')](_0x35f804[_0x49ce06('0x13')],_0x35f804['query']),_0x32b9a1[_0x49ce06('0x22')]=_[_0x49ce06('0x1')](_0x35f804[_0x49ce06('0x13')],qs[_0x49ce06('0x2e')](_0x38fb56[_0x49ce06('0x2a')][_0x49ce06('0x2e')])),_0x32b9a1['attributes']=_0x32b9a1[_0x49ce06('0x22')][_0x49ce06('0x1e')]?_0x32b9a1[_0x49ce06('0x22')]:_0x35f804[_0x49ce06('0x13')],_0x38fb56[_0x49ce06('0x2a')][_0x49ce06('0x7')]&&(_0x32b9a1[_0x49ce06('0x9')]=[{'all':!![]}]),_0x32b9a1=_[_0x49ce06('0x4')]({},_0x32b9a1,_0x38fb56[_0x49ce06('0x2d')]),db[_0x49ce06('0x3')][_0x49ce06('0x32')](_0x32b9a1)[_0x49ce06('0x30')](handleEntityNotFound(_0x2c552a,null))[_0x49ce06('0x30')](respondWithResult(_0x2c552a,null))[_0x49ce06('0x0')](handleError(_0x2c552a,null));},exports['create']=function(_0x57fa96,_0x4265e6){const _0x80ece4=_0x2e0c7c;return db['Dynamics365Field'][_0x80ece4('0x26')](_0x57fa96[_0x80ece4('0x12')],{})['then'](respondWithResult(_0x4265e6,0xc9))[_0x80ece4('0x0')](handleError(_0x4265e6,null));},exports[_0x2e0c7c('0x23')]=function(_0x11af0f,_0x3e9bec){const _0x47639e=_0x2e0c7c;return _0x11af0f[_0x47639e('0x12')]['id']&&delete _0x11af0f[_0x47639e('0x12')]['id'],db[_0x47639e('0x3')][_0x47639e('0x32')]({'where':{'id':_0x11af0f[_0x47639e('0x2c')]['id']}})[_0x47639e('0x30')](handleEntityNotFound(_0x3e9bec,null))[_0x47639e('0x30')](saveUpdates(_0x11af0f[_0x47639e('0x12')],null))[_0x47639e('0x30')](respondWithResult(_0x3e9bec,null))['catch'](handleError(_0x3e9bec,null));},exports[_0x2e0c7c('0x6')]=function(_0x3d1d7e,_0x24d25e){const _0x446299=_0x2e0c7c;return db[_0x446299('0x3')][_0x446299('0x32')]({'where':{'id':_0x3d1d7e[_0x446299('0x2c')]['id']}})[_0x446299('0x30')](handleEntityNotFound(_0x24d25e,null))[_0x446299('0x30')](removeEntity(_0x24d25e,null))['catch'](handleError(_0x24d25e,null));};
\ No newline at end of file
+const a251_0x53c1=['params','key','findOne','attributes','undefined','type','order','index','options','filters','fieldName','rawAttributes','merge','api','catch','set','model','body','../../config/logger','VIRTUAL','sort','limit','filter','update','query','where','error','end','offset','destroy','map','pick','findAll','../../mysqldb','like','intersection','keys','includeAll','create','rows','length','include','json','Dynamics365Field','count','name','status','show','../../components/parsers/qs','then','fields'];(function(_0x5ee4a6,_0x53c112){const _0xff9df8=function(_0x239c9e){while(--_0x239c9e){_0x5ee4a6['push'](_0x5ee4a6['shift']());}};_0xff9df8(++_0x53c112);}(a251_0x53c1,0x1f1));const a251_0xff9d=function(_0x5ee4a6,_0x53c112){_0x5ee4a6=_0x5ee4a6-0x0;let _0xff9df8=a251_0x53c1[_0x5ee4a6];return _0xff9df8;};const _0x583577=a251_0xff9d;'use strict';const _=require('lodash'),qs=require(_0x583577('0xa')),logger=require(_0x583577('0x1f'))(_0x583577('0x1a')),db=require(_0x583577('0x2e'))['db'],{Op}=require('sequelize');function respondWithResult(_0x239c9e,_0x192229){return _0x192229=_0x192229||0xc8,function(_0x2b84d3){if(_0x2b84d3)return _0x239c9e['status'](_0x192229)['json'](_0x2b84d3);};}function respondWithFilteredResult(_0x48c297,_0x37d996){return function(_0x500156){const _0x5dd87b=a251_0xff9d;if(_0x500156){const _0x1ff452=_0x500156[_0x5dd87b('0x6')],_0x183c56=_0x37d996['offset'];let _0x5314be=_0x37d996['offset']+_0x37d996['limit'],_0x27eb1c;return _0x5314be>=_0x1ff452?(_0x5314be=_0x1ff452,_0x27eb1c=0xc8):_0x27eb1c=0xce,_0x48c297[_0x5dd87b('0x8')](_0x27eb1c),_0x48c297[_0x5dd87b('0x1c')]('Content-Range',_0x183c56+'-'+_0x5314be+'/'+_0x1ff452)[_0x5dd87b('0x4')](_0x500156);}return null;};}function saveUpdates(_0x19d23e){return function(_0x44f8a0){const _0x4b57a3=a251_0xff9d;if(_0x44f8a0)return _0x44f8a0['update'](_0x19d23e)[_0x4b57a3('0xb')](function(_0x46ff72){return _0x46ff72;});return null;};}function removeEntity(_0x3ab84e){return function(_0x5cf845){const _0x54e6f0=a251_0xff9d;if(_0x5cf845)return _0x5cf845[_0x54e6f0('0x2a')]()[_0x54e6f0('0xb')](function(){const _0x29f6ac=_0x54e6f0;_0x3ab84e[_0x29f6ac('0x8')](0xcc)[_0x29f6ac('0x28')]();});};}function handleEntityNotFound(_0x3c61f4){return function(_0x4ebccf){return!_0x4ebccf&&_0x3c61f4['sendStatus'](0x194),_0x4ebccf;};}function handleError(_0x3f7d10,_0x3227c0){return _0x3227c0=_0x3227c0||0x1f4,function(_0x4c612b){const _0x357875=a251_0xff9d;logger[_0x357875('0x27')](_0x4c612b['stack']),_0x4c612b[_0x357875('0x7')]&&delete _0x4c612b[_0x357875('0x7')],_0x3f7d10[_0x357875('0x8')](_0x3227c0)['send'](_0x4c612b);};}exports[_0x583577('0x14')]=function(_0x132f68,_0x1c2852){const _0x479ab1=_0x583577;let _0xf50154={};const _0x2c1b7e={},_0x1fc168={'count':0x0,'rows':[]},_0x359aab=_[_0x479ab1('0x2b')](db[_0x479ab1('0x5')][_0x479ab1('0x18')],function(_0x4d2f9d){const _0x580591=_0x479ab1;return{'name':_0x4d2f9d[_0x580591('0x17')],'type':_0x4d2f9d[_0x580591('0x12')][_0x580591('0xe')]};});_0x2c1b7e['model']=_[_0x479ab1('0x2b')](_0x359aab,_0x479ab1('0x7')),_0x2c1b7e[_0x479ab1('0x25')]=_[_0x479ab1('0x31')](_0x132f68['query']),_0x2c1b7e[_0x479ab1('0x16')]=_[_0x479ab1('0x30')](_0x2c1b7e[_0x479ab1('0x1d')],_0x2c1b7e[_0x479ab1('0x25')]),_0xf50154[_0x479ab1('0x10')]=_[_0x479ab1('0x30')](_0x2c1b7e['model'],qs[_0x479ab1('0xc')](_0x132f68[_0x479ab1('0x25')][_0x479ab1('0xc')])),_0xf50154['attributes']=_0xf50154[_0x479ab1('0x10')][_0x479ab1('0x2')]?_0xf50154[_0x479ab1('0x10')]:_0x2c1b7e[_0x479ab1('0x1d')];typeof _0x132f68['query']['nolimit']===_0x479ab1('0x11')&&(_0xf50154[_0x479ab1('0x22')]=qs[_0x479ab1('0x22')](_0x132f68[_0x479ab1('0x25')][_0x479ab1('0x22')]),_0xf50154['offset']=qs['offset'](_0x132f68['query'][_0x479ab1('0x29')]));_0xf50154[_0x479ab1('0x13')]=qs[_0x479ab1('0x21')](_0x132f68[_0x479ab1('0x25')]['sort']),_0xf50154[_0x479ab1('0x26')]=qs[_0x479ab1('0x16')](_[_0x479ab1('0x2c')](_0x132f68['query'],_0x2c1b7e['filters']),_0x359aab);_0x132f68[_0x479ab1('0x25')][_0x479ab1('0x23')]&&(_0xf50154[_0x479ab1('0x26')]=_['merge'](_0xf50154[_0x479ab1('0x26')],{[Op['or']]:_[_0x479ab1('0x2b')](_0x359aab,function(_0x3cde85){const _0x4921e1=_0x479ab1;if(_0x3cde85[_0x4921e1('0x12')]!==_0x4921e1('0x20')){const _0x313764={};return _0x313764[_0x3cde85['name']]={[Op[_0x4921e1('0x2f')]]:'%'+_0x132f68[_0x4921e1('0x25')][_0x4921e1('0x23')]+'%'},_0x313764;}})}));_0xf50154=_[_0x479ab1('0x19')]({},_0xf50154,_0x132f68[_0x479ab1('0x15')]);const _0x128a62={'where':_0xf50154[_0x479ab1('0x26')]};return db[_0x479ab1('0x5')][_0x479ab1('0x6')](_0x128a62)['then'](function(_0x520e4f){const _0x5cb2d2=_0x479ab1;return _0x1fc168[_0x5cb2d2('0x6')]=_0x520e4f,_0x132f68[_0x5cb2d2('0x25')]['includeAll']&&(_0xf50154[_0x5cb2d2('0x3')]=[{'all':!![]}]),db[_0x5cb2d2('0x5')][_0x5cb2d2('0x2d')](_0xf50154);})[_0x479ab1('0xb')](function(_0x4a3d0c){const _0x4dc516=_0x479ab1;return _0x1fc168[_0x4dc516('0x1')]=_0x4a3d0c,_0x1fc168;})[_0x479ab1('0xb')](respondWithFilteredResult(_0x1c2852,_0xf50154))[_0x479ab1('0x1b')](handleError(_0x1c2852,null));},exports[_0x583577('0x9')]=function(_0x2ff4f3,_0x3d8b40){const _0x290938=_0x583577;let _0x2d4251={'raw':!![],'where':{'id':_0x2ff4f3['params']['id']}};const _0x2fef69={};return _0x2fef69[_0x290938('0x1d')]=_['keys'](db['Dynamics365Field'][_0x290938('0x18')]),_0x2fef69['query']=_['keys'](_0x2ff4f3['query']),_0x2fef69[_0x290938('0x16')]=_['intersection'](_0x2fef69[_0x290938('0x1d')],_0x2fef69[_0x290938('0x25')]),_0x2d4251[_0x290938('0x10')]=_[_0x290938('0x30')](_0x2fef69[_0x290938('0x1d')],qs[_0x290938('0xc')](_0x2ff4f3[_0x290938('0x25')][_0x290938('0xc')])),_0x2d4251[_0x290938('0x10')]=_0x2d4251[_0x290938('0x10')][_0x290938('0x2')]?_0x2d4251[_0x290938('0x10')]:_0x2fef69[_0x290938('0x1d')],_0x2ff4f3[_0x290938('0x25')][_0x290938('0x32')]&&(_0x2d4251[_0x290938('0x3')]=[{'all':!![]}]),_0x2d4251=_['merge']({},_0x2d4251,_0x2ff4f3[_0x290938('0x15')]),db['Dynamics365Field']['findOne'](_0x2d4251)[_0x290938('0xb')](handleEntityNotFound(_0x3d8b40,null))['then'](respondWithResult(_0x3d8b40,null))[_0x290938('0x1b')](handleError(_0x3d8b40,null));},exports[_0x583577('0x0')]=function(_0xfb2f5b,_0x3fff3d){const _0x4c505c=_0x583577;return db[_0x4c505c('0x5')][_0x4c505c('0x0')](_0xfb2f5b[_0x4c505c('0x1e')],{})[_0x4c505c('0xb')](respondWithResult(_0x3fff3d,0xc9))[_0x4c505c('0x1b')](handleError(_0x3fff3d,null));},exports[_0x583577('0x24')]=function(_0x1af983,_0x5c6dd4){const _0x1307a3=_0x583577;return _0x1af983['body']['id']&&delete _0x1af983[_0x1307a3('0x1e')]['id'],db[_0x1307a3('0x5')][_0x1307a3('0xf')]({'where':{'id':_0x1af983[_0x1307a3('0xd')]['id']}})[_0x1307a3('0xb')](handleEntityNotFound(_0x5c6dd4,null))[_0x1307a3('0xb')](saveUpdates(_0x1af983[_0x1307a3('0x1e')],null))[_0x1307a3('0xb')](respondWithResult(_0x5c6dd4,null))[_0x1307a3('0x1b')](handleError(_0x5c6dd4,null));},exports[_0x583577('0x2a')]=function(_0x243d81,_0x1f9e55){const _0x43c169=_0x583577;return db[_0x43c169('0x5')]['findOne']({'where':{'id':_0x243d81[_0x43c169('0xd')]['id']}})[_0x43c169('0xb')](handleEntityNotFound(_0x1f9e55,null))[_0x43c169('0xb')](removeEntity(_0x1f9e55,null))['catch'](handleError(_0x1f9e55,null));};
\ No newline at end of file