Built motion from commit 973e3e332e1c8e2f84c4b0cd2e5af794131724f5. Version 3.0.0...
[motion-next.git] / server / api / whatsappInteraction / whatsappInteraction.events.js
index 62e1576..d4f7f13 100644 (file)
@@ -1 +1 @@
-const a795_0x40e5=['catch','then','length','WhatsappInteraction','findAll','getUsers','Users','map','remove','../../mysqldb','exports','setMaxListeners','addHook','emit','setDataValue','events','update'];(function(_0x49b8c3,_0x40e55d){const _0x27e8f5=function(_0x24048c){while(--_0x24048c){_0x49b8c3['push'](_0x49b8c3['shift']());}};_0x27e8f5(++_0x40e55d);}(a795_0x40e5,0x190));const a795_0x27e8=function(_0x49b8c3,_0x40e55d){_0x49b8c3=_0x49b8c3-0x0;let _0x27e8f5=a795_0x40e5[_0x49b8c3];return _0x27e8f5;};const _0x15fba4=a795_0x27e8;'use strict';const EventEmitter=require(_0x15fba4('0x6')),WhatsappInteraction=require(_0x15fba4('0x0'))['db'][_0x15fba4('0xb')],WhatsappMessage=require(_0x15fba4('0x0'))['db']['WhatsappMessage'],WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x15fba4('0x2')](0x0);const events={'afterCreate':'save','afterUpdate':_0x15fba4('0x7'),'afterDestroy':_0x15fba4('0x10')};function emitEvent(_0x24048c){return function(_0x50219c){const _0x17439f=a795_0x27e8;_0x50219c[_0x17439f('0xd')]({'attributes':['id'],'raw':!![]})['then'](function(_0x16b7b9){const _0x12a175=_0x17439f;return _0x50219c[_0x12a175('0x5')](_0x12a175('0xe'),_0x16b7b9[_0x12a175('0xf')](function(_0x77ec5a){return{'id':_0x77ec5a['id']};})),WhatsappMessage[_0x12a175('0xc')]({'where':{'WhatsappInteractionId':_0x50219c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x17439f('0x9')](function(_0x30c5c5){const _0x43af37=_0x17439f;_0x50219c[_0x43af37('0x5')]('unreadMessages',_0x30c5c5[_0x43af37('0xa')]),WhatsappInteractionEvents[_0x43af37('0x4')](_0x24048c+':'+_0x50219c['id'],_0x50219c),WhatsappInteractionEvents['emit'](_0x24048c,_0x50219c);})[_0x17439f('0x8')](()=>{});};}for(const e in events){if(typeof events[e]!=='undefined'){const event=events[e];WhatsappInteraction[_0x15fba4('0x3')](e,emitEvent(event));}}module[_0x15fba4('0x1')]=WhatsappInteractionEvents;
\ No newline at end of file
+const a795_0x4797=['events','emit','length','WhatsappInteraction','getUsers','setDataValue','then','save','setMaxListeners','update','../../mysqldb','addHook','map','findAll'];(function(_0x512f49,_0x479793){const _0x3e45ee=function(_0x7bf05e){while(--_0x7bf05e){_0x512f49['push'](_0x512f49['shift']());}};_0x3e45ee(++_0x479793);}(a795_0x4797,0x195));const a795_0x3e45=function(_0x512f49,_0x479793){_0x512f49=_0x512f49-0x0;let _0x3e45ee=a795_0x4797[_0x512f49];return _0x3e45ee;};const _0x3c2b06=a795_0x3e45;'use strict';const EventEmitter=require(_0x3c2b06('0x1')),WhatsappInteraction=require('../../mysqldb')['db'][_0x3c2b06('0x4')],WhatsappMessage=require(_0x3c2b06('0xb'))['db']['WhatsappMessage'],WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3c2b06('0x9')](0x0);const events={'afterCreate':_0x3c2b06('0x8'),'afterUpdate':_0x3c2b06('0xa'),'afterDestroy':'remove'};function emitEvent(_0x7bf05e){return function(_0x2e9256){const _0x519f0f=a795_0x3e45;_0x2e9256[_0x519f0f('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x48a415){const _0x142b11=_0x519f0f;return _0x2e9256[_0x142b11('0x6')]('Users',_0x48a415[_0x142b11('0xd')](function(_0x2be24e){return{'id':_0x2be24e['id']};})),WhatsappMessage[_0x142b11('0x0')]({'where':{'WhatsappInteractionId':_0x2e9256['id'],'direction':'in','read':![]},'raw':!![]});})[_0x519f0f('0x7')](function(_0x322495){const _0x4d3adc=_0x519f0f;_0x2e9256[_0x4d3adc('0x6')]('unreadMessages',_0x322495[_0x4d3adc('0x3')]),WhatsappInteractionEvents[_0x4d3adc('0x2')](_0x7bf05e+':'+_0x2e9256['id'],_0x2e9256),WhatsappInteractionEvents[_0x4d3adc('0x2')](_0x7bf05e,_0x2e9256);})['catch'](()=>{});};}for(const e in events){if(typeof events[e]!=='undefined'){const event=events[e];WhatsappInteraction[_0x3c2b06('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents;
\ No newline at end of file