Built motion from commit 497d3d92.|2.5.43
[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 _0xd5b2=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0xd5b2,0x1b0));var _0x2d5b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xd5b2[_0x5c351c];return _0x26f3b3;};'use strict';var EventEmitter=require(_0x2d5b('0x0'));var WhatsappAccount=require(_0x2d5b('0x1'))['db'][_0x2d5b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2d5b('0x3')](0x0);var events={'afterCreate':_0x2d5b('0x4'),'afterUpdate':_0x2d5b('0x5'),'afterDestroy':_0x2d5b('0x6')};function emitEvent(_0x50567c){return function(_0x5e5f5e,_0x4027b2,_0x202938){WhatsappAccountEvents[_0x2d5b('0x7')](_0x50567c+':'+_0x5e5f5e['id'],_0x5e5f5e);WhatsappAccountEvents[_0x2d5b('0x7')](_0x50567c,_0x5e5f5e);_0x202938(null);};}for(var e in events){if(events[_0x2d5b('0x8')](e)){var event=events[e];WhatsappAccount[_0x2d5b('0x9')](e,emitEvent(event));}}module[_0x2d5b('0xa')]=WhatsappAccountEvents;