Built motion from commit 973e3e332e1c8e2f84c4b0cd2e5af794131724f5. Version 3.0.0...
[motion-next.git] / server / api / integrationReport / integrationReport.controller.js
1 const a363_0x3595=['json','order','../../components/parsers/qs','nolimit','destroy','rows','options','like','api','length','catch','where','show','key','merge','keys','count','offset','params','intersection','name','create','undefined','attributes','Content-Range','pick','sort','status','describe','query','body','index','../../config/logger','type','update','IntegrationReport','model','fields','includeAll','filter','sequelize','set','rawAttributes','then','../../mysqldb','sendStatus','findOne','filters','include','limit','lodash'];(function(_0x5693c9,_0x3595da){const _0x4bf4ff=function(_0x4e8cb3){while(--_0x4e8cb3){_0x5693c9['push'](_0x5693c9['shift']());}};_0x4bf4ff(++_0x3595da);}(a363_0x3595,0x116));const a363_0x4bf4=function(_0x5693c9,_0x3595da){_0x5693c9=_0x5693c9-0x0;let _0x4bf4ff=a363_0x3595[_0x5693c9];return _0x4bf4ff;};const _0x3efdac=a363_0x4bf4;'use strict';const _=require(_0x3efdac('0x1b')),qs=require(_0x3efdac('0x1e')),logger=require(_0x3efdac('0x9'))(_0x3efdac('0x24')),db=require(_0x3efdac('0x15'))['db'],{Op}=require(_0x3efdac('0x11'));function respondWithResult(_0x4e8cb3,_0x1b16fc){return _0x1b16fc=_0x1b16fc||0xc8,function(_0x205606){const _0x189545=a363_0x4bf4;if(_0x205606)return _0x4e8cb3[_0x189545('0x4')](_0x1b16fc)[_0x189545('0x1c')](_0x205606);};}function respondWithFilteredResult(_0x151570,_0x5cca89){return function(_0x28a00a){const _0x3d6f0e=a363_0x4bf4;if(_0x28a00a){const _0x5dc882=_0x28a00a[_0x3d6f0e('0x2c')],_0x2affbd=_0x5cca89[_0x3d6f0e('0x2d')];let _0x392030=_0x5cca89[_0x3d6f0e('0x2d')]+_0x5cca89['limit'],_0x48b34b;return _0x392030>=_0x5dc882?(_0x392030=_0x5dc882,_0x48b34b=0xc8):_0x48b34b=0xce,_0x151570[_0x3d6f0e('0x4')](_0x48b34b),_0x151570[_0x3d6f0e('0x12')](_0x3d6f0e('0x1'),_0x2affbd+'-'+_0x392030+'/'+_0x5dc882)[_0x3d6f0e('0x1c')](_0x28a00a);}return null;};}function saveUpdates(_0x5e4b96){return function(_0x5be19d){const _0x564e3f=a363_0x4bf4;if(_0x5be19d)return _0x5be19d[_0x564e3f('0xb')](_0x5e4b96)[_0x564e3f('0x14')](function(_0x2b47f2){return _0x2b47f2;});return null;};}function removeEntity(_0x568600){return function(_0x5df524){const _0x2ecaac=a363_0x4bf4;if(_0x5df524)return _0x5df524[_0x2ecaac('0x20')]()[_0x2ecaac('0x14')](function(){const _0x30380e=_0x2ecaac;_0x568600[_0x30380e('0x4')](0xcc)['end']();});};}function handleEntityNotFound(_0xa3b219){return function(_0x76f1f1){const _0x1ca48d=a363_0x4bf4;return!_0x76f1f1&&_0xa3b219[_0x1ca48d('0x16')](0x194),_0x76f1f1;};}function handleError(_0xe86174,_0x51536e){return _0x51536e=_0x51536e||0x1f4,function(_0x2f4ba0){const _0x547116=a363_0x4bf4;logger['error'](_0x2f4ba0['stack']),_0x2f4ba0[_0x547116('0x30')]&&delete _0x2f4ba0[_0x547116('0x30')],_0xe86174['status'](_0x51536e)['send'](_0x2f4ba0);};}exports[_0x3efdac('0x8')]=function(_0x4ad887,_0x27e91e){const _0x39509f=_0x3efdac;let _0x19708a={};const _0x9145a1={},_0x252de6={'count':0x0,'rows':[]},_0x121d98=_['map'](db[_0x39509f('0xc')][_0x39509f('0x13')],function(_0x376154){const _0x4c02b5=_0x39509f;return{'name':_0x376154['fieldName'],'type':_0x376154['type'][_0x4c02b5('0x29')]};});_0x9145a1[_0x39509f('0xd')]=_['map'](_0x121d98,_0x39509f('0x30')),_0x9145a1['query']=_[_0x39509f('0x2b')](_0x4ad887[_0x39509f('0x6')]),_0x9145a1[_0x39509f('0x18')]=_['intersection'](_0x9145a1[_0x39509f('0xd')],_0x9145a1[_0x39509f('0x6')]),_0x19708a['attributes']=_[_0x39509f('0x2f')](_0x9145a1['model'],qs['fields'](_0x4ad887[_0x39509f('0x6')][_0x39509f('0xe')])),_0x19708a[_0x39509f('0x0')]=_0x19708a['attributes'][_0x39509f('0x25')]?_0x19708a['attributes']:_0x9145a1[_0x39509f('0xd')];typeof _0x4ad887[_0x39509f('0x6')][_0x39509f('0x1f')]===_0x39509f('0x32')&&(_0x19708a['limit']=qs[_0x39509f('0x1a')](_0x4ad887[_0x39509f('0x6')][_0x39509f('0x1a')]),_0x19708a[_0x39509f('0x2d')]=qs['offset'](_0x4ad887[_0x39509f('0x6')][_0x39509f('0x2d')]));_0x19708a[_0x39509f('0x1d')]=qs['sort'](_0x4ad887[_0x39509f('0x6')][_0x39509f('0x3')]),_0x19708a[_0x39509f('0x27')]=qs['filters'](_[_0x39509f('0x2')](_0x4ad887[_0x39509f('0x6')],_0x9145a1[_0x39509f('0x18')]),_0x121d98);_0x4ad887[_0x39509f('0x6')][_0x39509f('0x10')]&&(_0x19708a[_0x39509f('0x27')]=_[_0x39509f('0x2a')](_0x19708a[_0x39509f('0x27')],{[Op['or']]:_['map'](_0x121d98,function(_0x517c27){const _0x4bac5e=_0x39509f;if(_0x517c27[_0x4bac5e('0xa')]!=='VIRTUAL'){const _0xdc1fec={};return _0xdc1fec[_0x517c27[_0x4bac5e('0x30')]]={[Op[_0x4bac5e('0x23')]]:'%'+_0x4ad887[_0x4bac5e('0x6')][_0x4bac5e('0x10')]+'%'},_0xdc1fec;}})}));_0x19708a=_[_0x39509f('0x2a')]({},_0x19708a,_0x4ad887[_0x39509f('0x22')]);const _0x9d05c6={'where':_0x19708a[_0x39509f('0x27')]};return db[_0x39509f('0xc')][_0x39509f('0x2c')](_0x9d05c6)[_0x39509f('0x14')](function(_0x24704d){const _0x3722ef=_0x39509f;return _0x252de6['count']=_0x24704d,_0x4ad887[_0x3722ef('0x6')][_0x3722ef('0xf')]&&(_0x19708a[_0x3722ef('0x19')]=[{'all':!![]}]),db[_0x3722ef('0xc')]['findAll'](_0x19708a);})[_0x39509f('0x14')](function(_0x2e7b53){const _0x2c0a05=_0x39509f;return _0x252de6[_0x2c0a05('0x21')]=_0x2e7b53,_0x252de6;})[_0x39509f('0x14')](respondWithFilteredResult(_0x27e91e,_0x19708a))[_0x39509f('0x26')](handleError(_0x27e91e,null));},exports[_0x3efdac('0x28')]=function(_0x3f4784,_0x5bf161){const _0x224364=_0x3efdac;let _0x2c4998={'raw':![],'where':{'id':_0x3f4784['params']['id']}};const _0x2abee9={};return _0x2abee9[_0x224364('0xd')]=_['keys'](db[_0x224364('0xc')]['rawAttributes']),_0x2abee9['query']=_['keys'](_0x3f4784[_0x224364('0x6')]),_0x2abee9['filters']=_[_0x224364('0x2f')](_0x2abee9[_0x224364('0xd')],_0x2abee9[_0x224364('0x6')]),_0x2c4998[_0x224364('0x0')]=_['intersection'](_0x2abee9[_0x224364('0xd')],qs['fields'](_0x3f4784[_0x224364('0x6')][_0x224364('0xe')])),_0x2c4998[_0x224364('0x0')]=_0x2c4998['attributes'][_0x224364('0x25')]?_0x2c4998[_0x224364('0x0')]:_0x2abee9[_0x224364('0xd')],_0x3f4784['query'][_0x224364('0xf')]&&(_0x2c4998[_0x224364('0x19')]=[{'all':!![]}]),_0x2c4998=_['merge']({},_0x2c4998,_0x3f4784[_0x224364('0x22')]),db[_0x224364('0xc')]['findOne'](_0x2c4998)[_0x224364('0x14')](handleEntityNotFound(_0x5bf161,null))[_0x224364('0x14')](respondWithResult(_0x5bf161,null))['catch'](handleError(_0x5bf161,null));},exports[_0x3efdac('0x31')]=function(_0x2fc7fd,_0x500118){const _0x546358=_0x3efdac;return db[_0x546358('0xc')][_0x546358('0x31')](_0x2fc7fd[_0x546358('0x7')],{})[_0x546358('0x14')](respondWithResult(_0x500118,0xc9))['catch'](handleError(_0x500118,null));},exports[_0x3efdac('0xb')]=function(_0x50d863,_0x583f8c){const _0x46c244=_0x3efdac;return _0x50d863[_0x46c244('0x7')]['id']&&delete _0x50d863[_0x46c244('0x7')]['id'],db['IntegrationReport'][_0x46c244('0x17')]({'where':{'id':_0x50d863['params']['id']}})[_0x46c244('0x14')](handleEntityNotFound(_0x583f8c,null))['then'](saveUpdates(_0x50d863[_0x46c244('0x7')],null))[_0x46c244('0x14')](respondWithResult(_0x583f8c,null))[_0x46c244('0x26')](handleError(_0x583f8c,null));},exports['destroy']=function(_0x1e103f,_0x4e7d43){const _0x458d45=_0x3efdac;return db['IntegrationReport'][_0x458d45('0x17')]({'where':{'id':_0x1e103f[_0x458d45('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4e7d43,null))['then'](removeEntity(_0x4e7d43,null))[_0x458d45('0x26')](handleError(_0x4e7d43,null));},exports[_0x3efdac('0x5')]=function(_0x308f3b,_0x411a6f){const _0x5b88a1=_0x3efdac;return db[_0x5b88a1('0xc')][_0x5b88a1('0x5')]()[_0x5b88a1('0x14')](respondWithResult(_0x411a6f,null))[_0x5b88a1('0x26')](handleError(_0x411a6f,null));};