Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / chatInteraction / chatInteraction.events.js
index 2690bc6..665afc9 100644 (file)
@@ -1 +1 @@
-const a67_0x46c7=['getUsers','Users','ChatInteraction','emit','setDataValue','then','catch','length','undefined','unreadMessages','update','../../mysqldb','ChatMessage','setMaxListeners','save','events'];(function(_0x152b93,_0x46c748){const _0x5d10a5=function(_0x412d71){while(--_0x412d71){_0x152b93['push'](_0x152b93['shift']());}};_0x5d10a5(++_0x46c748);}(a67_0x46c7,0x1b2));const a67_0x5d10=function(_0x152b93,_0x46c748){_0x152b93=_0x152b93-0x0;let _0x5d10a5=a67_0x46c7[_0x152b93];return _0x5d10a5;};const _0x1a8070=a67_0x5d10;'use strict';const EventEmitter=require(_0x1a8070('0xd')),ChatInteraction=require(_0x1a8070('0x9'))['db'][_0x1a8070('0x0')],ChatMessage=require(_0x1a8070('0x9'))['db'][_0x1a8070('0xa')],ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1a8070('0xb')](0x0);const events={'afterCreate':_0x1a8070('0xc'),'afterUpdate':_0x1a8070('0x8'),'afterDestroy':'remove'};function emitEvent(_0x412d71){return function(_0x36bb4b){const _0x2eab3c=a67_0x5d10;_0x36bb4b[_0x2eab3c('0xe')]({'attributes':['id'],'raw':!![]})[_0x2eab3c('0x3')](function(_0x3d0c29){const _0x404185=_0x2eab3c;return _0x36bb4b[_0x404185('0x2')](_0x404185('0xf'),_0x3d0c29['map'](function(_0x2d4ae9){return{'id':_0x2d4ae9['id']};})),ChatMessage['findAll']({'where':{'ChatInteractionId':_0x36bb4b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2eab3c('0x3')](function(_0x2663d1){const _0x5ace3c=_0x2eab3c;_0x36bb4b[_0x5ace3c('0x2')](_0x5ace3c('0x7'),_0x2663d1[_0x5ace3c('0x5')]),ChatInteractionEvents[_0x5ace3c('0x1')](_0x412d71+':'+_0x36bb4b['id'],_0x36bb4b),ChatInteractionEvents[_0x5ace3c('0x1')](_0x412d71,_0x36bb4b);})[_0x2eab3c('0x4')](()=>{});};}for(const e in events){if(typeof events[e]!==_0x1a8070('0x6')){const event=events[e];ChatInteraction['addHook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents;
\ No newline at end of file
+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