c412c5bb72b1330e915e9f878cce6f0bf17e2198
[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 _0x68ce=['save','emit','hasOwnProperty','events','Team','setMaxListeners'];(function(_0x1383b0,_0x48dd2a){var _0x5989b1=function(_0x5b9615){while(--_0x5b9615){_0x1383b0['push'](_0x1383b0['shift']());}};_0x5989b1(++_0x48dd2a);}(_0x68ce,0x10b));var _0xe68c=function(_0x389c88,_0x46d30a){_0x389c88=_0x389c88-0x0;var _0x32b899=_0x68ce[_0x389c88];return _0x32b899;};'use strict';var EventEmitter=require(_0xe68c('0x0'));var Team=require('../../mysqldb')['db'][_0xe68c('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xe68c('0x2')](0x0);var events={'afterCreate':_0xe68c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x292b41){return function(_0xf75e70,_0x1daeb1,_0x165241){TeamEvents[_0xe68c('0x4')](_0x292b41+':'+_0xf75e70['id'],_0xf75e70);TeamEvents[_0xe68c('0x4')](_0x292b41,_0xf75e70);_0x165241(null);};}for(var e in events){if(events[_0xe68c('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents;