Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.events.js
index 5ab7d32..e37ec5a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x80c7=['save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x2de5d9,_0x4bfa45){var _0x53a8ba=function(_0x5b0c6b){while(--_0x5b0c6b){_0x2de5d9['push'](_0x2de5d9['shift']());}};_0x53a8ba(++_0x4bfa45);}(_0x80c7,0x8d));var _0x780c=function(_0x170c58,_0x6b8a51){_0x170c58=_0x170c58-0x0;var _0x4a3aee=_0x80c7[_0x170c58];return _0x4a3aee;};'use strict';var EventEmitter=require(_0x780c('0x0'));var WhatsappInteraction=require(_0x780c('0x1'))['db'][_0x780c('0x2')];var WhatsappMessage=require(_0x780c('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x780c('0x3'),'afterUpdate':'update','afterDestroy':_0x780c('0x4')};function emitEvent(_0xccccf8){return function(_0x2293a3,_0x1a5fc2,_0x26db15){_0x2293a3[_0x780c('0x5')]({'attributes':['id'],'raw':!![]})[_0x780c('0x6')](function(_0x269976){_0x2293a3[_0x780c('0x7')](_0x780c('0x8'),_0x269976[_0x780c('0x9')](function(_0x54a4ed){return{'id':_0x54a4ed['id']};}));return WhatsappMessage[_0x780c('0xa')]({'where':{'WhatsappInteractionId':_0x2293a3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x780c('0x6')](function(_0x5c1ec3){_0x2293a3[_0x780c('0x7')](_0x780c('0xb'),_0x5c1ec3[_0x780c('0xc')]);WhatsappInteractionEvents['emit'](_0xccccf8+':'+_0x2293a3['id'],_0x2293a3);WhatsappInteractionEvents[_0x780c('0xd')](_0xccccf8,_0x2293a3);_0x26db15(null);})[_0x780c('0xe')](_0x26db15(null));};}for(var e in events){if(events[_0x780c('0xf')](e)){var event=events[e];WhatsappInteraction[_0x780c('0x10')](e,emitEvent(event));}}module[_0x780c('0x11')]=WhatsappInteractionEvents;
\ No newline at end of file
+var _0x8b1a=['hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','setDataValue','map','then','emit','catch','hasOwnProperty'];(function(_0x59367f,_0x4ef562){var _0x14cb44=function(_0x1058f0){while(--_0x1058f0){_0x59367f['push'](_0x59367f['shift']());}};_0x14cb44(++_0x4ef562);}(_0x8b1a,0x152));var _0xa8b1=function(_0x20ca2d,_0x46fbf9){_0x20ca2d=_0x20ca2d-0x0;var _0x20ac11=_0x8b1a[_0x20ca2d];return _0x20ac11;};'use strict';var EventEmitter=require(_0xa8b1('0x0'));var WhatsappInteraction=require(_0xa8b1('0x1'))['db'][_0xa8b1('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xa8b1('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa8b1('0x4')](0x0);var events={'afterCreate':_0xa8b1('0x5'),'afterUpdate':'update','afterDestroy':_0xa8b1('0x6')};function emitEvent(_0x2427cc){return function(_0x1981aa,_0xf65f47,_0x493b8e){_0x1981aa[_0xa8b1('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a3030){_0x1981aa[_0xa8b1('0x8')]('Users',_0x2a3030[_0xa8b1('0x9')](function(_0x27f578){return{'id':_0x27f578['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1981aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa8b1('0xa')](function(_0x2f0be9){_0x1981aa[_0xa8b1('0x8')]('unreadMessages',_0x2f0be9['length']);WhatsappInteractionEvents[_0xa8b1('0xb')](_0x2427cc+':'+_0x1981aa['id'],_0x1981aa);WhatsappInteractionEvents['emit'](_0x2427cc,_0x1981aa);_0x493b8e(null);})[_0xa8b1('0xc')](_0x493b8e(null));};}for(var e in events){if(events[_0xa8b1('0xd')](e)){var event=events[e];WhatsappInteraction[_0xa8b1('0xe')](e,emitEvent(event));}}module[_0xa8b1('0xf')]=WhatsappInteractionEvents;
\ No newline at end of file