Built motion from commit 459747fdfe53bbf13fbede61eeaffea1f1438f86. Version 3.0.0...
[motion-next.git] / server / api / chatInteraction / chatInteraction.events.js
index 665afc9..13db5e5 100644 (file)
@@ -1 +1 @@
-const a67_0x4d9c=['then','undefined','ChatMessage','remove','save','events','length','../../mysqldb','unreadMessages','Users','exports','map','addHook','setMaxListeners','findAll','ChatInteraction','emit','setDataValue','update'];(function(_0xc85ace,_0x4d9c14){const _0x2aa73f=function(_0x202c95){while(--_0x202c95){_0xc85ace['push'](_0xc85ace['shift']());}};_0x2aa73f(++_0x4d9c14);}(a67_0x4d9c,0x1d4));const a67_0x2aa7=function(_0xc85ace,_0x4d9c14){_0xc85ace=_0xc85ace-0x0;let _0x2aa73f=a67_0x4d9c[_0xc85ace];return _0x2aa73f;};const _0x545920=a67_0x2aa7;'use strict';const EventEmitter=require(_0x545920('0xc')),ChatInteraction=require('../../mysqldb')['db'][_0x545920('0x3')],ChatMessage=require(_0x545920('0xe'))['db'][_0x545920('0x9')],ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x545920('0x1')](0x0);const events={'afterCreate':_0x545920('0xb'),'afterUpdate':_0x545920('0x6'),'afterDestroy':_0x545920('0xa')};function emitEvent(_0x202c95){return function(_0x1a7d39){const _0x436732=a67_0x2aa7;_0x1a7d39['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x22a649){const _0x3b7d60=a67_0x2aa7;return _0x1a7d39[_0x3b7d60('0x5')](_0x3b7d60('0x10'),_0x22a649[_0x3b7d60('0x12')](function(_0x1e720d){return{'id':_0x1e720d['id']};})),ChatMessage[_0x3b7d60('0x2')]({'where':{'ChatInteractionId':_0x1a7d39['id'],'direction':'in','read':![]},'raw':!![]});})[_0x436732('0x7')](function(_0x1978dd){const _0x2b1624=_0x436732;_0x1a7d39[_0x2b1624('0x5')](_0x2b1624('0xf'),_0x1978dd[_0x2b1624('0xd')]),ChatInteractionEvents[_0x2b1624('0x4')](_0x202c95+':'+_0x1a7d39['id'],_0x1a7d39),ChatInteractionEvents[_0x2b1624('0x4')](_0x202c95,_0x1a7d39);})['catch'](()=>{});};}for(const e in events){if(typeof events[e]!==_0x545920('0x8')){const event=events[e];ChatInteraction[_0x545920('0x0')](e,emitEvent(event));}}module[_0x545920('0x11')]=ChatInteractionEvents;
\ No newline at end of file
+const a67_0xa364=['map','getUsers','remove','setMaxListeners','../../mysqldb','addHook','update','catch','unreadMessages','emit','Users','setDataValue','undefined','length','ChatMessage','then'];(function(_0x348134,_0xa364ac){const _0x18fe44=function(_0x5851ac){while(--_0x5851ac){_0x348134['push'](_0x348134['shift']());}};_0x18fe44(++_0xa364ac);}(a67_0xa364,0xff));const a67_0x18fe=function(_0x348134,_0xa364ac){_0x348134=_0x348134-0x0;let _0x18fe44=a67_0xa364[_0x348134];return _0x18fe44;};const _0x438d75=a67_0x18fe;'use strict';const EventEmitter=require('events'),ChatInteraction=require(_0x438d75('0x5'))['db']['ChatInteraction'],ChatMessage=require(_0x438d75('0x5'))['db'][_0x438d75('0xf')],ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x438d75('0x4')](0x0);const events={'afterCreate':'save','afterUpdate':_0x438d75('0x7'),'afterDestroy':_0x438d75('0x3')};function emitEvent(_0x5851ac){return function(_0x13fbe7){const _0x5a89c0=a67_0x18fe;_0x13fbe7[_0x5a89c0('0x2')]({'attributes':['id'],'raw':!![]})[_0x5a89c0('0x0')](function(_0x584d52){const _0x33c34f=_0x5a89c0;return _0x13fbe7[_0x33c34f('0xc')](_0x33c34f('0xb'),_0x584d52[_0x33c34f('0x1')](function(_0x2aa944){return{'id':_0x2aa944['id']};})),ChatMessage['findAll']({'where':{'ChatInteractionId':_0x13fbe7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a89c0('0x0')](function(_0x299d92){const _0x46761e=_0x5a89c0;_0x13fbe7[_0x46761e('0xc')](_0x46761e('0x9'),_0x299d92[_0x46761e('0xe')]),ChatInteractionEvents[_0x46761e('0xa')](_0x5851ac+':'+_0x13fbe7['id'],_0x13fbe7),ChatInteractionEvents['emit'](_0x5851ac,_0x13fbe7);})[_0x5a89c0('0x8')](()=>{});};}for(const e in events){if(typeof events[e]!==_0x438d75('0xd')){const event=events[e];ChatInteraction[_0x438d75('0x6')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents;
\ No newline at end of file