3d3985b829f04da57d68d001aa712929bde484d5
[motion2.git] / server / api / team / team.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 _0x62a4=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','hasOwnProperty','exports'];(function(_0x7fa3ff,_0x139d6a){var _0x27103d=function(_0x3f369c){while(--_0x3f369c){_0x7fa3ff['push'](_0x7fa3ff['shift']());}};_0x27103d(++_0x139d6a);}(_0x62a4,0xea));var _0x462a=function(_0x483f0,_0x329df8){_0x483f0=_0x483f0-0x0;var _0x59a8eb=_0x62a4[_0x483f0];return _0x59a8eb;};'use strict';var EventEmitter=require(_0x462a('0x0'));var Team=require(_0x462a('0x1'))['db'][_0x462a('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x462a('0x3')](0x0);var events={'afterCreate':_0x462a('0x4'),'afterUpdate':_0x462a('0x5'),'afterDestroy':_0x462a('0x6')};function emitEvent(_0x1a8bf4){return function(_0x4aadc3,_0x1cc19f,_0x2754ce){TeamEvents['emit'](_0x1a8bf4+':'+_0x4aadc3['id'],_0x4aadc3);TeamEvents['emit'](_0x1a8bf4,_0x4aadc3);_0x2754ce(null);};}for(var e in events){if(events[_0x462a('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x462a('0x8')]=TeamEvents;