Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.events.js
index 386fb07..f9bb9f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfec5=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3cf699,_0x3240b5){var _0x21c009=function(_0x593a24){while(--_0x593a24){_0x3cf699['push'](_0x3cf699['shift']());}};_0x21c009(++_0x3240b5);}(_0xfec5,0x83));var _0x5fec=function(_0x5855c1,_0x4e62ba){_0x5855c1=_0x5855c1-0x0;var _0x1712ca=_0xfec5[_0x5855c1];return _0x1712ca;};'use strict';var EventEmitter=require(_0x5fec('0x0'));var WhatsappInteraction=require(_0x5fec('0x1'))['db'][_0x5fec('0x2')];var WhatsappMessage=require(_0x5fec('0x1'))['db'][_0x5fec('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5fec('0x4')](0x0);var events={'afterCreate':_0x5fec('0x5'),'afterUpdate':_0x5fec('0x6'),'afterDestroy':_0x5fec('0x7')};function emitEvent(_0x48db19){return function(_0x290987,_0x4aa3f9,_0xed3aec){_0x290987[_0x5fec('0x8')]({'attributes':['id'],'raw':!![]})[_0x5fec('0x9')](function(_0x278a8c){_0x290987[_0x5fec('0xa')](_0x5fec('0xb'),_0x278a8c[_0x5fec('0xc')](function(_0x33499c){return{'id':_0x33499c['id']};}));return WhatsappMessage[_0x5fec('0xd')]({'where':{'WhatsappInteractionId':_0x290987['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5fec('0x9')](function(_0x315376){_0x290987[_0x5fec('0xa')]('unreadMessages',_0x315376[_0x5fec('0xe')]);WhatsappInteractionEvents[_0x5fec('0xf')](_0x48db19+':'+_0x290987['id'],_0x290987);WhatsappInteractionEvents[_0x5fec('0xf')](_0x48db19,_0x290987);_0xed3aec(null);})['catch'](_0xed3aec(null));};}for(var e in events){if(events[_0x5fec('0x10')](e)){var event=events[e];WhatsappInteraction[_0x5fec('0x11')](e,emitEvent(event));}}module[_0x5fec('0x12')]=WhatsappInteractionEvents;
\ No newline at end of file
+var _0x3d7f=['setMaxListeners','save','update','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','exports','events','WhatsappInteraction','WhatsappMessage'];(function(_0x1123bb,_0x54472a){var _0xdeb602=function(_0x529467){while(--_0x529467){_0x1123bb['push'](_0x1123bb['shift']());}};_0xdeb602(++_0x54472a);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x3d7f[_0x5c3c0b];return _0x52ecd2;};'use strict';var EventEmitter=require(_0xf3d7('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf3d7('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xf3d7('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf3d7('0x3')](0x0);var events={'afterCreate':_0xf3d7('0x4'),'afterUpdate':_0xf3d7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x574073){return function(_0x433483,_0x20fb37,_0x5b667c){_0x433483['getUsers']({'attributes':['id'],'raw':!![]})[_0xf3d7('0x6')](function(_0x17d875){_0x433483[_0xf3d7('0x7')]('Users',_0x17d875[_0xf3d7('0x8')](function(_0x2d2bcd){return{'id':_0x2d2bcd['id']};}));return WhatsappMessage[_0xf3d7('0x9')]({'where':{'WhatsappInteractionId':_0x433483['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf3d7('0x6')](function(_0x167637){_0x433483[_0xf3d7('0x7')](_0xf3d7('0xa'),_0x167637[_0xf3d7('0xb')]);WhatsappInteractionEvents[_0xf3d7('0xc')](_0x574073+':'+_0x433483['id'],_0x433483);WhatsappInteractionEvents[_0xf3d7('0xc')](_0x574073,_0x433483);_0x5b667c(null);})[_0xf3d7('0xd')](_0x5b667c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf3d7('0xe')]=WhatsappInteractionEvents;
\ No newline at end of file