4c95858a09c538eec237c396aade63bbb29bef08
[motion2.git] / server / api / whatsappAccount / whatsappAccount.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 _0xe004=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe004,0x1e1));var _0x4e00=function(_0x190940,_0x1886ae){_0x190940=_0x190940-0x0;var _0x34f9e2=_0xe004[_0x190940];return _0x34f9e2;};'use strict';var EventEmitter=require(_0x4e00('0x0'));var WhatsappAccount=require(_0x4e00('0x1'))['db'][_0x4e00('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x4e00('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e00('0x4'),'afterDestroy':_0x4e00('0x5')};function emitEvent(_0x50cae9){return function(_0x4145f8,_0x5bb873,_0x37ecf7){WhatsappAccountEvents[_0x4e00('0x6')](_0x50cae9+':'+_0x4145f8['id'],_0x4145f8);WhatsappAccountEvents['emit'](_0x50cae9,_0x4145f8);_0x37ecf7(null);};}for(var e in events){if(events[_0x4e00('0x7')](e)){var event=events[e];WhatsappAccount[_0x4e00('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents;