Built motion from commit 85328c08.|2.5.50
[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 _0x503f=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x44974a,_0x2c2a10){var _0x4b4f9b=function(_0x40d486){while(--_0x40d486){_0x44974a['push'](_0x44974a['shift']());}};_0x4b4f9b(++_0x2c2a10);}(_0x503f,0x108));var _0xf503=function(_0x48aaa3,_0x183ef0){_0x48aaa3=_0x48aaa3-0x0;var _0x43ef26=_0x503f[_0x48aaa3];return _0x43ef26;};'use strict';var EventEmitter=require(_0xf503('0x0'));var Team=require(_0xf503('0x1'))['db'][_0xf503('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xf503('0x3')](0x0);var events={'afterCreate':_0xf503('0x4'),'afterUpdate':_0xf503('0x5'),'afterDestroy':_0xf503('0x6')};function emitEvent(_0x2bacca){return function(_0x1a4995,_0x4d82f7,_0x196bbd){TeamEvents[_0xf503('0x7')](_0x2bacca+':'+_0x1a4995['id'],_0x1a4995);TeamEvents[_0xf503('0x7')](_0x2bacca,_0x1a4995);_0x196bbd(null);};}for(var e in events){if(events[_0xf503('0x8')](e)){var event=events[e];Team[_0xf503('0x9')](e,emitEvent(event));}}module[_0xf503('0xa')]=TeamEvents;