6c1a67c126c65276a1268ea6a702d630a11b475d
[motion-next.git] / server / api / template / template.rpc.js
1 const a635_0x1ff9=['GetTemplate','info','then','raw','../../config/logger','../../mysqldb','model','map','Template','options','catch','error','include','findAll','where','message','attributes'];(function(_0x1b1896,_0x1ff901){const _0x87c7e2=function(_0x17362a){while(--_0x17362a){_0x1b1896['push'](_0x1b1896['shift']());}};_0x87c7e2(++_0x1ff901);}(a635_0x1ff9,0x77));const a635_0x87c7=function(_0x1b1896,_0x1ff901){_0x1b1896=_0x1b1896-0x0;let _0x87c7e2=a635_0x1ff9[_0x1b1896];return _0x87c7e2;};const _0x49cbbc=a635_0x87c7;'use strict';const _=require('lodash'),db=require(_0x49cbbc('0x5'))['db'],logger=require(_0x49cbbc('0x4'))('rpc');exports[_0x49cbbc('0x0')]=function(_0x17362a){const _0x46cf8d=this;return new Promise(function(_0x37b448,_0x569fe1){const _0x10538e=a635_0x87c7;return db[_0x10538e('0x8')][_0x10538e('0xd')]({'raw':_0x17362a[_0x10538e('0x9')]?_0x17362a[_0x10538e('0x9')][_0x10538e('0x3')]===undefined?!![]:![]:!![],'where':_0x17362a[_0x10538e('0x9')]?_0x17362a[_0x10538e('0x9')][_0x10538e('0xe')]||null:null,'attributes':_0x17362a[_0x10538e('0x9')]?_0x17362a[_0x10538e('0x9')]['attributes']||null:null,'limit':_0x17362a[_0x10538e('0x9')]?_0x17362a[_0x10538e('0x9')]['limit']||null:null,'include':_0x17362a[_0x10538e('0x9')]?_0x17362a[_0x10538e('0x9')][_0x10538e('0xc')]?_[_0x10538e('0x7')](_0x17362a[_0x10538e('0x9')][_0x10538e('0xc')],function(_0x5e0a5d){const _0x3ff506=_0x10538e;return{'model':db[_0x5e0a5d[_0x3ff506('0x6')]],'as':_0x5e0a5d['as'],'attributes':_0x5e0a5d['attributes'],'include':_0x5e0a5d['include']?_[_0x3ff506('0x7')](_0x5e0a5d[_0x3ff506('0xc')],function(_0x5432bc){const _0x366bf9=_0x3ff506;return{'model':db[_0x5432bc[_0x366bf9('0x6')]],'as':_0x5432bc['as'],'attributes':_0x5432bc[_0x366bf9('0x10')],'include':_0x5432bc[_0x366bf9('0xc')]?_[_0x366bf9('0x7')](_0x5432bc[_0x366bf9('0xc')],function(_0x2b1008){const _0x32627f=_0x366bf9;return{'model':db[_0x2b1008[_0x32627f('0x6')]],'as':_0x2b1008['as'],'attributes':_0x2b1008[_0x32627f('0x10')]};}):[]};}):[]};}):[]:[]})[_0x10538e('0x2')](function(_0x35d221){const _0x26a2dc=_0x10538e;logger[_0x26a2dc('0x1')](_0x26a2dc('0x0'),_0x17362a),logger['debug'](_0x26a2dc('0x0'),_0x17362a,JSON['stringify'](_0x35d221)),_0x37b448(_0x35d221);})[_0x10538e('0xa')](function(_0x366821){const _0x4c4f6c=_0x10538e;logger['error'](_0x4c4f6c('0x0'),_0x366821['message'],_0x17362a),_0x569fe1(_0x46cf8d[_0x4c4f6c('0xb')](0x1f4,_0x366821[_0x4c4f6c('0xf')]));});});};