Built motion from commit aab208717af8d15f4fa224cdb6a202877019af9b. Version 3.0.0...
[motion-next.git] / server / api / migration / migration.controller.js
1 const a453_0x6ac0=['nolimit','order','sequelize','../../config/logger','fields','api','../../components/parsers/qs','name','rows','attributes','sort','map','json','then','intersection','Migration','undefined','where','status','catch','../../mysqldb','filter','merge','rawAttributes','error','pick','limit','filters','keys','include','count','length','model','stack','type','query','offset','lodash','VIRTUAL','like','options','fieldName'];(function(_0x15209a,_0x6ac01d){const _0x277946=function(_0x1777ef){while(--_0x1777ef){_0x15209a['push'](_0x15209a['shift']());}};_0x277946(++_0x6ac01d);}(a453_0x6ac0,0x198));const a453_0x2779=function(_0x15209a,_0x6ac01d){_0x15209a=_0x15209a-0x0;let _0x277946=a453_0x6ac0[_0x15209a];return _0x277946;};const _0x13b44d=a453_0x2779;'use strict';const _=require(_0x13b44d('0x7')),qs=require(_0x13b44d('0x12')),logger=require(_0x13b44d('0xf'))(_0x13b44d('0x11')),db=require(_0x13b44d('0x20'))['db'],{Op}=require(_0x13b44d('0xe'));function respondWithFilteredResult(_0x1777ef,_0x2b08fa){return function(_0x3b6066){const _0x233818=a453_0x2779;if(_0x3b6066){const _0x52082b=_0x3b6066[_0x233818('0x0')],_0x194a63=_0x2b08fa[_0x233818('0x6')];let _0x52e7df=_0x2b08fa[_0x233818('0x6')]+_0x2b08fa['limit'],_0x33acac;return _0x52e7df>=_0x52082b?(_0x52e7df=_0x52082b,_0x33acac=0xc8):_0x33acac=0xce,_0x1777ef['status'](_0x33acac),_0x1777ef['set']('Content-Range',_0x194a63+'-'+_0x52e7df+'/'+_0x52082b)[_0x233818('0x18')](_0x3b6066);}return null;};}function handleError(_0x272ef1,_0x1d7d5d){return _0x1d7d5d=_0x1d7d5d||0x1f4,function(_0x347c32){const _0x1c875f=a453_0x2779;logger[_0x1c875f('0x24')](_0x347c32[_0x1c875f('0x3')]),_0x347c32[_0x1c875f('0x13')]&&delete _0x347c32[_0x1c875f('0x13')],_0x272ef1[_0x1c875f('0x1e')](_0x1d7d5d)['send'](_0x347c32);};}exports['index']=function(_0x3bcc5c,_0x39656e){const _0x20e926=_0x13b44d;let _0xd4abdb={};const _0x50c7d7={},_0x52638e={'count':0x0,'rows':[]},_0xd22d83=_[_0x20e926('0x17')](db[_0x20e926('0x1b')][_0x20e926('0x23')],function(_0x538fdd){const _0x4a65db=_0x20e926;return{'name':_0x538fdd[_0x4a65db('0xb')],'type':_0x538fdd[_0x4a65db('0x4')]['key']};});_0x50c7d7[_0x20e926('0x2')]=_['map'](_0xd22d83,'name'),_0x50c7d7[_0x20e926('0x5')]=_[_0x20e926('0x28')](_0x3bcc5c[_0x20e926('0x5')]),_0x50c7d7[_0x20e926('0x27')]=_[_0x20e926('0x1a')](_0x50c7d7['model'],_0x50c7d7[_0x20e926('0x5')]),_0xd4abdb[_0x20e926('0x15')]=_[_0x20e926('0x1a')](_0x50c7d7[_0x20e926('0x2')],qs[_0x20e926('0x10')](_0x3bcc5c[_0x20e926('0x5')][_0x20e926('0x10')])),_0xd4abdb['attributes']=_0xd4abdb['attributes'][_0x20e926('0x1')]?_0xd4abdb[_0x20e926('0x15')]:_0x50c7d7[_0x20e926('0x2')];typeof _0x3bcc5c[_0x20e926('0x5')][_0x20e926('0xc')]===_0x20e926('0x1c')&&(_0xd4abdb[_0x20e926('0x26')]=qs[_0x20e926('0x26')](_0x3bcc5c[_0x20e926('0x5')]['limit']),_0xd4abdb['offset']=qs[_0x20e926('0x6')](_0x3bcc5c[_0x20e926('0x5')]['offset']));_0xd4abdb[_0x20e926('0xd')]=qs[_0x20e926('0x16')](_0x3bcc5c['query'][_0x20e926('0x16')]),_0xd4abdb['where']=qs[_0x20e926('0x27')](_[_0x20e926('0x25')](_0x3bcc5c[_0x20e926('0x5')],_0x50c7d7['filters']),_0xd22d83);_0x3bcc5c[_0x20e926('0x5')][_0x20e926('0x21')]&&(_0xd4abdb[_0x20e926('0x1d')]=_[_0x20e926('0x22')](_0xd4abdb[_0x20e926('0x1d')],{[Op['or']]:_['map'](_0xd22d83,function(_0x3fbb46){const _0x593c79=_0x20e926;if(_0x3fbb46[_0x593c79('0x4')]!==_0x593c79('0x8')){const _0x3f3c23={};return _0x3f3c23[_0x3fbb46[_0x593c79('0x13')]]={[Op[_0x593c79('0x9')]]:'%'+_0x3bcc5c[_0x593c79('0x5')][_0x593c79('0x21')]+'%'},_0x3f3c23;}})}));_0xd4abdb=_[_0x20e926('0x22')]({},_0xd4abdb,_0x3bcc5c[_0x20e926('0xa')]);const _0x324357={'where':_0xd4abdb[_0x20e926('0x1d')]};return db['Migration']['count'](_0x324357)['then'](function(_0x9ae25b){const _0x5daad6=_0x20e926;return _0x52638e[_0x5daad6('0x0')]=_0x9ae25b,_0x3bcc5c[_0x5daad6('0x5')]['includeAll']&&(_0xd4abdb[_0x5daad6('0x29')]=[{'all':!![]}]),db[_0x5daad6('0x1b')]['findAll'](_0xd4abdb);})[_0x20e926('0x19')](function(_0x5dbd47){const _0x2f5bbb=_0x20e926;return _0x52638e[_0x2f5bbb('0x14')]=_0x5dbd47,_0x52638e;})[_0x20e926('0x19')](respondWithFilteredResult(_0x39656e,_0xd4abdb))[_0x20e926('0x1f')](handleError(_0x39656e,null));};