Built motion from commit f651e4b0a7312c0adceb5e57d6684a801a3aaf0d. Version 3.0.0...
[motion-next.git] / server / api / intDynamics365Field / intDynamics365Field.controller.js
1 const a251_0x26cf=['body','destroy','catch','type','create','rawAttributes','lodash','../../config/logger','keys','json','rows','intersection','Dynamics365Field','model','merge','status','findAll','filters','set','map','query','nolimit','key','VIRTUAL','includeAll','undefined','params','filter','count','fields','then','name','update','where','Content-Range','../../mysqldb','error','sort','end','length','offset','limit','pick','attributes','findOne','include','send'];(function(_0x334ed8,_0x26cffb){const _0x5a3828=function(_0x54ca26){while(--_0x54ca26){_0x334ed8['push'](_0x334ed8['shift']());}};_0x5a3828(++_0x26cffb);}(a251_0x26cf,0x9e));const a251_0x5a38=function(_0x334ed8,_0x26cffb){_0x334ed8=_0x334ed8-0x0;let _0x5a3828=a251_0x26cf[_0x334ed8];return _0x5a3828;};const _0xeb8cfc=a251_0x5a38;'use strict';const _=require(_0xeb8cfc('0x24')),qs=require('../../components/parsers/qs'),logger=require(_0xeb8cfc('0x25'))('api'),db=require(_0xeb8cfc('0x12'))['db'],{Op}=require('sequelize');function respondWithResult(_0x54ca26,_0x35510b){return _0x35510b=_0x35510b||0xc8,function(_0x1d0add){if(_0x1d0add)return _0x54ca26['status'](_0x35510b)['json'](_0x1d0add);};}function respondWithFilteredResult(_0x40dd50,_0x2cdf05){return function(_0x4fb8d4){const _0x127d20=a251_0x5a38;if(_0x4fb8d4){const _0x80adc=_0x4fb8d4['count'],_0x5a5c4a=_0x2cdf05['offset'];let _0x31f971=_0x2cdf05[_0x127d20('0x17')]+_0x2cdf05[_0x127d20('0x18')],_0x2fde8b;return _0x31f971>=_0x80adc?(_0x31f971=_0x80adc,_0x2fde8b=0xc8):_0x2fde8b=0xce,_0x40dd50['status'](_0x2fde8b),_0x40dd50[_0x127d20('0x1')](_0x127d20('0x11'),_0x5a5c4a+'-'+_0x31f971+'/'+_0x80adc)[_0x127d20('0x27')](_0x4fb8d4);}return null;};}function saveUpdates(_0x2d5b35){return function(_0x2fa2fb){const _0x64c426=a251_0x5a38;if(_0x2fa2fb)return _0x2fa2fb[_0x64c426('0xf')](_0x2d5b35)[_0x64c426('0xd')](function(_0x328e11){return _0x328e11;});return null;};}function removeEntity(_0x3acfa2){return function(_0x1be8fa){const _0x52a9bb=a251_0x5a38;if(_0x1be8fa)return _0x1be8fa[_0x52a9bb('0x1f')]()[_0x52a9bb('0xd')](function(){const _0x421342=_0x52a9bb;_0x3acfa2['status'](0xcc)[_0x421342('0x15')]();});};}function handleEntityNotFound(_0x5dca42){return function(_0x42eca3){return!_0x42eca3&&_0x5dca42['sendStatus'](0x194),_0x42eca3;};}function handleError(_0x558015,_0x1fa7de){return _0x1fa7de=_0x1fa7de||0x1f4,function(_0x62f93c){const _0x33f733=a251_0x5a38;logger[_0x33f733('0x13')](_0x62f93c['stack']),_0x62f93c[_0x33f733('0xe')]&&delete _0x62f93c[_0x33f733('0xe')],_0x558015[_0x33f733('0x2d')](_0x1fa7de)[_0x33f733('0x1d')](_0x62f93c);};}exports['index']=function(_0x5917b3,_0x15687a){const _0x52a15c=_0xeb8cfc;let _0x465ab7={};const _0x1fe426={},_0x54fa21={'count':0x0,'rows':[]},_0x1bf80f=_[_0x52a15c('0x2')](db[_0x52a15c('0x2a')][_0x52a15c('0x23')],function(_0xa69935){const _0x17fc1b=_0x52a15c;return{'name':_0xa69935['fieldName'],'type':_0xa69935['type'][_0x17fc1b('0x5')]};});_0x1fe426['model']=_[_0x52a15c('0x2')](_0x1bf80f,_0x52a15c('0xe')),_0x1fe426[_0x52a15c('0x3')]=_[_0x52a15c('0x26')](_0x5917b3[_0x52a15c('0x3')]),_0x1fe426[_0x52a15c('0x0')]=_[_0x52a15c('0x29')](_0x1fe426[_0x52a15c('0x2b')],_0x1fe426[_0x52a15c('0x3')]),_0x465ab7[_0x52a15c('0x1a')]=_['intersection'](_0x1fe426[_0x52a15c('0x2b')],qs['fields'](_0x5917b3[_0x52a15c('0x3')]['fields'])),_0x465ab7[_0x52a15c('0x1a')]=_0x465ab7['attributes'][_0x52a15c('0x16')]?_0x465ab7['attributes']:_0x1fe426[_0x52a15c('0x2b')];typeof _0x5917b3['query'][_0x52a15c('0x4')]===_0x52a15c('0x8')&&(_0x465ab7['limit']=qs[_0x52a15c('0x18')](_0x5917b3[_0x52a15c('0x3')]['limit']),_0x465ab7[_0x52a15c('0x17')]=qs[_0x52a15c('0x17')](_0x5917b3[_0x52a15c('0x3')]['offset']));_0x465ab7['order']=qs[_0x52a15c('0x14')](_0x5917b3['query'][_0x52a15c('0x14')]),_0x465ab7[_0x52a15c('0x10')]=qs[_0x52a15c('0x0')](_[_0x52a15c('0x19')](_0x5917b3[_0x52a15c('0x3')],_0x1fe426[_0x52a15c('0x0')]),_0x1bf80f);_0x5917b3[_0x52a15c('0x3')][_0x52a15c('0xa')]&&(_0x465ab7[_0x52a15c('0x10')]=_[_0x52a15c('0x2c')](_0x465ab7[_0x52a15c('0x10')],{[Op['or']]:_[_0x52a15c('0x2')](_0x1bf80f,function(_0x64b41b){const _0x176561=_0x52a15c;if(_0x64b41b[_0x176561('0x21')]!==_0x176561('0x6')){const _0x2ebe06={};return _0x2ebe06[_0x64b41b[_0x176561('0xe')]]={[Op['like']]:'%'+_0x5917b3[_0x176561('0x3')][_0x176561('0xa')]+'%'},_0x2ebe06;}})}));_0x465ab7=_[_0x52a15c('0x2c')]({},_0x465ab7,_0x5917b3['options']);const _0x4a6aee={'where':_0x465ab7[_0x52a15c('0x10')]};return db[_0x52a15c('0x2a')]['count'](_0x4a6aee)[_0x52a15c('0xd')](function(_0x101ea9){const _0x364cc8=_0x52a15c;return _0x54fa21[_0x364cc8('0xb')]=_0x101ea9,_0x5917b3[_0x364cc8('0x3')]['includeAll']&&(_0x465ab7['include']=[{'all':!![]}]),db[_0x364cc8('0x2a')][_0x364cc8('0x2e')](_0x465ab7);})[_0x52a15c('0xd')](function(_0x14a4c5){const _0x536907=_0x52a15c;return _0x54fa21[_0x536907('0x28')]=_0x14a4c5,_0x54fa21;})[_0x52a15c('0xd')](respondWithFilteredResult(_0x15687a,_0x465ab7))[_0x52a15c('0x20')](handleError(_0x15687a,null));},exports['show']=function(_0x4522fc,_0x277377){const _0xd9f914=_0xeb8cfc;let _0x586301={'raw':!![],'where':{'id':_0x4522fc['params']['id']}};const _0x865278={};return _0x865278[_0xd9f914('0x2b')]=_[_0xd9f914('0x26')](db[_0xd9f914('0x2a')][_0xd9f914('0x23')]),_0x865278[_0xd9f914('0x3')]=_['keys'](_0x4522fc[_0xd9f914('0x3')]),_0x865278[_0xd9f914('0x0')]=_['intersection'](_0x865278[_0xd9f914('0x2b')],_0x865278[_0xd9f914('0x3')]),_0x586301[_0xd9f914('0x1a')]=_[_0xd9f914('0x29')](_0x865278[_0xd9f914('0x2b')],qs[_0xd9f914('0xc')](_0x4522fc[_0xd9f914('0x3')][_0xd9f914('0xc')])),_0x586301[_0xd9f914('0x1a')]=_0x586301[_0xd9f914('0x1a')][_0xd9f914('0x16')]?_0x586301['attributes']:_0x865278[_0xd9f914('0x2b')],_0x4522fc[_0xd9f914('0x3')][_0xd9f914('0x7')]&&(_0x586301[_0xd9f914('0x1c')]=[{'all':!![]}]),_0x586301=_[_0xd9f914('0x2c')]({},_0x586301,_0x4522fc['options']),db[_0xd9f914('0x2a')][_0xd9f914('0x1b')](_0x586301)[_0xd9f914('0xd')](handleEntityNotFound(_0x277377,null))[_0xd9f914('0xd')](respondWithResult(_0x277377,null))['catch'](handleError(_0x277377,null));},exports[_0xeb8cfc('0x22')]=function(_0x3f1cd1,_0x38afea){const _0x27625e=_0xeb8cfc;return db[_0x27625e('0x2a')][_0x27625e('0x22')](_0x3f1cd1[_0x27625e('0x1e')],{})[_0x27625e('0xd')](respondWithResult(_0x38afea,0xc9))[_0x27625e('0x20')](handleError(_0x38afea,null));},exports['update']=function(_0x5baf04,_0x3fcd38){const _0x33d4d0=_0xeb8cfc;return _0x5baf04[_0x33d4d0('0x1e')]['id']&&delete _0x5baf04['body']['id'],db[_0x33d4d0('0x2a')][_0x33d4d0('0x1b')]({'where':{'id':_0x5baf04['params']['id']}})[_0x33d4d0('0xd')](handleEntityNotFound(_0x3fcd38,null))[_0x33d4d0('0xd')](saveUpdates(_0x5baf04[_0x33d4d0('0x1e')],null))[_0x33d4d0('0xd')](respondWithResult(_0x3fcd38,null))[_0x33d4d0('0x20')](handleError(_0x3fcd38,null));},exports['destroy']=function(_0x1025d6,_0x4a3887){const _0x570244=_0xeb8cfc;return db[_0x570244('0x2a')][_0x570244('0x1b')]({'where':{'id':_0x1025d6[_0x570244('0x9')]['id']}})[_0x570244('0xd')](handleEntityNotFound(_0x4a3887,null))['then'](removeEntity(_0x4a3887,null))[_0x570244('0x20')](handleError(_0x4a3887,null));};