Built motion from commit 709aa6fb5ed03aa61bc373fcdbf622215d37d30b. Version 3.0.0...
[motion-next.git] / server / api / migration / migration.controller.js
1 const a453_0x2c91=['limit','then','status','Migration','options','query','map','findAll','order','Content-Range','intersection','fieldName','merge','offset','VIRTUAL','api','name','../../config/logger','count','where','type','stack','pick','send','rows','catch','model','filter','sequelize','error','key','keys','include','set','fields','like','length','../../mysqldb','json','lodash','attributes','sort','rawAttributes','nolimit','undefined','filters'];(function(_0x3069c5,_0x2c91ac){const _0x5e08f3=function(_0x329966){while(--_0x329966){_0x3069c5['push'](_0x3069c5['shift']());}};_0x5e08f3(++_0x2c91ac);}(a453_0x2c91,0xc6));const a453_0x5e08=function(_0x3069c5,_0x2c91ac){_0x3069c5=_0x3069c5-0x0;let _0x5e08f3=a453_0x2c91[_0x3069c5];return _0x5e08f3;};const _0x5ae559=a453_0x5e08;'use strict';const _=require(_0x5ae559('0x19')),qs=require('../../components/parsers/qs'),logger=require(_0x5ae559('0x3'))(_0x5ae559('0x1')),db=require(_0x5ae559('0x17'))['db'],{Op}=require(_0x5ae559('0xe'));function respondWithFilteredResult(_0x329966,_0x233137){return function(_0x506513){const _0x108432=a453_0x5e08;if(_0x506513){const _0x96bfe6=_0x506513['count'],_0xab585a=_0x233137[_0x108432('0x2d')];let _0x1c6091=_0x233137[_0x108432('0x2d')]+_0x233137[_0x108432('0x20')],_0x553e92;return _0x1c6091>=_0x96bfe6?(_0x1c6091=_0x96bfe6,_0x553e92=0xc8):_0x553e92=0xce,_0x329966[_0x108432('0x22')](_0x553e92),_0x329966[_0x108432('0x13')](_0x108432('0x29'),_0xab585a+'-'+_0x1c6091+'/'+_0x96bfe6)[_0x108432('0x18')](_0x506513);}return null;};}function handleError(_0x22ea70,_0x667013){return _0x667013=_0x667013||0x1f4,function(_0x474984){const _0x4f4a54=a453_0x5e08;logger[_0x4f4a54('0xf')](_0x474984[_0x4f4a54('0x7')]),_0x474984[_0x4f4a54('0x2')]&&delete _0x474984[_0x4f4a54('0x2')],_0x22ea70[_0x4f4a54('0x22')](_0x667013)[_0x4f4a54('0x9')](_0x474984);};}exports['index']=function(_0xb4242c,_0x509325){const _0x58ab97=_0x5ae559;let _0x2ccae8={};const _0x385255={},_0x256e61={'count':0x0,'rows':[]},_0x1f7345=_[_0x58ab97('0x26')](db[_0x58ab97('0x23')][_0x58ab97('0x1c')],function(_0x31c71f){const _0x381d58=_0x58ab97;return{'name':_0x31c71f[_0x381d58('0x2b')],'type':_0x31c71f['type'][_0x381d58('0x10')]};});_0x385255[_0x58ab97('0xc')]=_[_0x58ab97('0x26')](_0x1f7345,'name'),_0x385255[_0x58ab97('0x25')]=_[_0x58ab97('0x11')](_0xb4242c['query']),_0x385255[_0x58ab97('0x1f')]=_[_0x58ab97('0x2a')](_0x385255[_0x58ab97('0xc')],_0x385255[_0x58ab97('0x25')]),_0x2ccae8[_0x58ab97('0x1a')]=_[_0x58ab97('0x2a')](_0x385255[_0x58ab97('0xc')],qs[_0x58ab97('0x14')](_0xb4242c['query']['fields'])),_0x2ccae8['attributes']=_0x2ccae8[_0x58ab97('0x1a')][_0x58ab97('0x16')]?_0x2ccae8[_0x58ab97('0x1a')]:_0x385255['model'];typeof _0xb4242c[_0x58ab97('0x25')][_0x58ab97('0x1d')]===_0x58ab97('0x1e')&&(_0x2ccae8['limit']=qs[_0x58ab97('0x20')](_0xb4242c['query'][_0x58ab97('0x20')]),_0x2ccae8[_0x58ab97('0x2d')]=qs[_0x58ab97('0x2d')](_0xb4242c[_0x58ab97('0x25')][_0x58ab97('0x2d')]));_0x2ccae8[_0x58ab97('0x28')]=qs[_0x58ab97('0x1b')](_0xb4242c[_0x58ab97('0x25')][_0x58ab97('0x1b')]),_0x2ccae8[_0x58ab97('0x5')]=qs[_0x58ab97('0x1f')](_[_0x58ab97('0x8')](_0xb4242c['query'],_0x385255['filters']),_0x1f7345);_0xb4242c[_0x58ab97('0x25')]['filter']&&(_0x2ccae8[_0x58ab97('0x5')]=_[_0x58ab97('0x2c')](_0x2ccae8[_0x58ab97('0x5')],{[Op['or']]:_[_0x58ab97('0x26')](_0x1f7345,function(_0x53e1d2){const _0x3dcd9f=_0x58ab97;if(_0x53e1d2[_0x3dcd9f('0x6')]!==_0x3dcd9f('0x0')){const _0x3a0b7a={};return _0x3a0b7a[_0x53e1d2[_0x3dcd9f('0x2')]]={[Op[_0x3dcd9f('0x15')]]:'%'+_0xb4242c['query'][_0x3dcd9f('0xd')]+'%'},_0x3a0b7a;}})}));_0x2ccae8=_[_0x58ab97('0x2c')]({},_0x2ccae8,_0xb4242c[_0x58ab97('0x24')]);const _0x32d495={'where':_0x2ccae8['where']};return db[_0x58ab97('0x23')][_0x58ab97('0x4')](_0x32d495)[_0x58ab97('0x21')](function(_0x47ae51){const _0x34d79b=_0x58ab97;return _0x256e61[_0x34d79b('0x4')]=_0x47ae51,_0xb4242c[_0x34d79b('0x25')]['includeAll']&&(_0x2ccae8[_0x34d79b('0x12')]=[{'all':!![]}]),db[_0x34d79b('0x23')][_0x34d79b('0x27')](_0x2ccae8);})[_0x58ab97('0x21')](function(_0x1b15ae){const _0x28b128=_0x58ab97;return _0x256e61[_0x28b128('0xa')]=_0x1b15ae,_0x256e61;})[_0x58ab97('0x21')](respondWithFilteredResult(_0x509325,_0x2ccae8))[_0x58ab97('0xb')](handleError(_0x509325,null));};