Built motion from commit 9c91e9f5.|2.6.29
[motion2.git] / server / api / whatsappMessage / whatsappMessage.events.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xb62e=['hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x40c749,_0x4f6291){var _0x414cd7=function(_0x33b600){while(--_0x33b600){_0x40c749['push'](_0x40c749['shift']());}};_0x414cd7(++_0x4f6291);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xeb62('0x0'));var WhatsappMessage=require(_0xeb62('0x1'))['db'][_0xeb62('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xeb62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb62('0x4'),'afterDestroy':_0xeb62('0x5')};function emitEvent(_0x45728e){return function(_0x929329,_0x3c7ad5,_0x1ebdbb){WhatsappMessageEvents['emit'](_0x45728e+':'+_0x929329['id'],_0x929329);WhatsappMessageEvents[_0xeb62('0x6')](_0x45728e,_0x929329);_0x1ebdbb(null);};}for(var e in events){if(events[_0xeb62('0x7')](e)){var event=events[e];WhatsappMessage[_0xeb62('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents;