ea3431c84e9101497537520e1c36ae3b8da240fd
[motion-next.git] / server / api / user / user.events.js
1 const a649_0x5516=['exports','undefined','setMaxListeners','remove','events','../../mysqldb','emit','User','update','addHook'];(function(_0x183c02,_0x551603){const _0x3645e2=function(_0x279ebb){while(--_0x279ebb){_0x183c02['push'](_0x183c02['shift']());}};_0x3645e2(++_0x551603);}(a649_0x5516,0x15b));const a649_0x3645=function(_0x183c02,_0x551603){_0x183c02=_0x183c02-0x0;let _0x3645e2=a649_0x5516[_0x183c02];return _0x3645e2;};const _0x5f53c7=a649_0x3645;'use strict';const EventEmitter=require(_0x5f53c7('0x7')),User=require(_0x5f53c7('0x8'))['db'][_0x5f53c7('0x0')],UserEvents=new EventEmitter();UserEvents[_0x5f53c7('0x5')](0x0);const events={'afterCreate':'save','afterUpdate':_0x5f53c7('0x1'),'afterDestroy':_0x5f53c7('0x6')};function emitEvent(_0x279ebb){return function(_0x3a73dc){const _0x2cf412=a649_0x3645;UserEvents['emit'](_0x279ebb+':'+_0x3a73dc['id'],_0x3a73dc),UserEvents[_0x2cf412('0x9')](_0x279ebb,_0x3a73dc);};}for(const e in events){if(typeof events[e]!==_0x5f53c7('0x4')){const event=events[e];User[_0x5f53c7('0x2')](e,emitEvent(event));}}module[_0x5f53c7('0x3')]=UserEvents;