cea359532e5e749a65d07e604fcc04138623c77d
[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 _0x232a=['save','update','emit','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x7a70b5,_0x13cc24){var _0x367b9d=function(_0x2bcc47){while(--_0x2bcc47){_0x7a70b5['push'](_0x7a70b5['shift']());}};_0x367b9d(++_0x13cc24);}(_0x232a,0x13c));var _0xa232=function(_0x3bd0b2,_0x5538e8){_0x3bd0b2=_0x3bd0b2-0x0;var _0x3839b4=_0x232a[_0x3bd0b2];return _0x3839b4;};'use strict';var EventEmitter=require(_0xa232('0x0'));var Team=require(_0xa232('0x1'))['db'][_0xa232('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa232('0x3')](0x0);var events={'afterCreate':_0xa232('0x4'),'afterUpdate':_0xa232('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3e3c45){return function(_0x4eb24d,_0x4495cf,_0x4c0c6a){TeamEvents[_0xa232('0x6')](_0x3e3c45+':'+_0x4eb24d['id'],_0x4eb24d);TeamEvents['emit'](_0x3e3c45,_0x4eb24d);_0x4c0c6a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xa232('0x7')]=TeamEvents;