3941bdec92072746fe56967203effe0ce4af32d9
[motion-next.git] / server / api / trigger / trigger.rpc.js
1 const a640_0x3451=['Trigger','info','message','GetTrigger','findOne','options','raw','../../mysqldb','attributes','ShowTrigger','include','lodash','map','../../config/logger','catch','model','where','then','debug','findAll','error'];(function(_0x45330b,_0x345176){const _0xc57536=function(_0x25e9b0){while(--_0x25e9b0){_0x45330b['push'](_0x45330b['shift']());}};_0xc57536(++_0x345176);}(a640_0x3451,0x172));const a640_0xc575=function(_0x45330b,_0x345176){_0x45330b=_0x45330b-0x0;let _0xc57536=a640_0x3451[_0x45330b];return _0xc57536;};const _0x4070c6=a640_0xc575;'use strict';const _=require(_0x4070c6('0x13')),db=require(_0x4070c6('0xf'))['db'],logger=require(_0x4070c6('0x0'))('rpc');exports['GetTrigger']=function(_0x25e9b0){const _0x3fc9a5=this;return new Promise(function(_0x29dcee,_0x3d6703){const _0x4a3fb0=a640_0xc575;return db[_0x4a3fb0('0x8')][_0x4a3fb0('0x6')]({'raw':_0x25e9b0[_0x4a3fb0('0xd')]?_0x25e9b0['options'][_0x4a3fb0('0xe')]===undefined?!![]:![]:!![],'where':_0x25e9b0[_0x4a3fb0('0xd')]?_0x25e9b0[_0x4a3fb0('0xd')][_0x4a3fb0('0x3')]||null:null,'attributes':_0x25e9b0['options']?_0x25e9b0[_0x4a3fb0('0xd')][_0x4a3fb0('0x10')]||null:null,'limit':_0x25e9b0['options']?_0x25e9b0[_0x4a3fb0('0xd')]['limit']||null:null,'include':_0x25e9b0[_0x4a3fb0('0xd')]?_0x25e9b0[_0x4a3fb0('0xd')][_0x4a3fb0('0x12')]?_['map'](_0x25e9b0['options'][_0x4a3fb0('0x12')],function(_0x5ae33f){const _0x253500=_0x4a3fb0;return{'model':db[_0x5ae33f[_0x253500('0x2')]],'as':_0x5ae33f['as'],'attributes':_0x5ae33f[_0x253500('0x10')],'include':_0x5ae33f['include']?_['map'](_0x5ae33f[_0x253500('0x12')],function(_0x316392){const _0x103094=_0x253500;return{'model':db[_0x316392[_0x103094('0x2')]],'as':_0x316392['as'],'attributes':_0x316392[_0x103094('0x10')],'include':_0x316392['include']?_[_0x103094('0x14')](_0x316392['include'],function(_0x53ac2b){const _0x12b4ee=_0x103094;return{'model':db[_0x53ac2b['model']],'as':_0x53ac2b['as'],'attributes':_0x53ac2b[_0x12b4ee('0x10')]};}):[]};}):[]};}):[]:[]})[_0x4a3fb0('0x4')](function(_0x491c2f){const _0x50ce91=_0x4a3fb0;logger[_0x50ce91('0x9')](_0x50ce91('0xb'),_0x25e9b0),logger['debug'](_0x50ce91('0xb'),_0x25e9b0,JSON['stringify'](_0x491c2f)),_0x29dcee(_0x491c2f);})[_0x4a3fb0('0x1')](function(_0x3cb2c5){const _0x299ca0=_0x4a3fb0;logger[_0x299ca0('0x7')](_0x299ca0('0xb'),_0x3cb2c5[_0x299ca0('0xa')],_0x25e9b0),_0x3d6703(_0x3fc9a5['error'](0x1f4,_0x3cb2c5[_0x299ca0('0xa')]));});});},exports[_0x4070c6('0x11')]=function(_0x130619){const _0x517d4b=this;return new Promise(function(_0x364b46,_0x2e3fde){const _0x51cf9d=a640_0xc575;return db['Trigger'][_0x51cf9d('0xc')]({'raw':_0x130619[_0x51cf9d('0xd')]?_0x130619[_0x51cf9d('0xd')][_0x51cf9d('0xe')]===undefined?!![]:![]:!![],'where':_0x130619[_0x51cf9d('0xd')]?_0x130619[_0x51cf9d('0xd')]['where']||null:null,'attributes':_0x130619['options']?_0x130619[_0x51cf9d('0xd')][_0x51cf9d('0x10')]||null:null,'include':_0x130619[_0x51cf9d('0xd')]?_0x130619[_0x51cf9d('0xd')]['include']?_[_0x51cf9d('0x14')](_0x130619[_0x51cf9d('0xd')][_0x51cf9d('0x12')],function(_0x5818d6){const _0x172324=_0x51cf9d;return{'model':db[_0x5818d6['model']],'as':_0x5818d6['as'],'attributes':_0x5818d6[_0x172324('0x10')],'include':_0x5818d6[_0x172324('0x12')]?_['map'](_0x5818d6['include'],function(_0x24d46d){const _0x3bf22d=_0x172324;return{'model':db[_0x24d46d[_0x3bf22d('0x2')]],'as':_0x24d46d['as'],'attributes':_0x24d46d[_0x3bf22d('0x10')],'include':_0x24d46d['include']?_[_0x3bf22d('0x14')](_0x24d46d['include'],function(_0x29f2c9){const _0x48f2c4=_0x3bf22d;return{'model':db[_0x29f2c9[_0x48f2c4('0x2')]],'as':_0x29f2c9['as'],'attributes':_0x29f2c9[_0x48f2c4('0x10')]};}):[]};}):[]};}):[]:[]})[_0x51cf9d('0x4')](function(_0x54b3fb){const _0x25935f=_0x51cf9d;logger[_0x25935f('0x9')]('ShowTrigger',_0x130619),logger[_0x25935f('0x5')](_0x25935f('0x11'),_0x130619,JSON['stringify'](_0x54b3fb)),_0x364b46(_0x54b3fb);})['catch'](function(_0xf01fd6){const _0x160373=_0x51cf9d;logger[_0x160373('0x7')]('ShowTrigger',_0xf01fd6[_0x160373('0xa')],_0x130619),_0x2e3fde(_0x517d4b[_0x160373('0x7')](0x1f4,_0xf01fd6[_0x160373('0xa')]));});});};