Built motion from commit e0fa946e.|2.6.5
[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 _0xebb0=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x7ac4ad,_0x4f6324){var _0x43885d=function(_0x2edcc5){while(--_0x2edcc5){_0x7ac4ad['push'](_0x7ac4ad['shift']());}};_0x43885d(++_0x4f6324);}(_0xebb0,0xd8));var _0x0ebb=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0xebb0[_0x596284];return _0x5313c6;};'use strict';var EventEmitter=require(_0x0ebb('0x0'));var Team=require(_0x0ebb('0x1'))['db'][_0x0ebb('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x0ebb('0x3')](0x0);var events={'afterCreate':_0x0ebb('0x4'),'afterUpdate':'update','afterDestroy':_0x0ebb('0x5')};function emitEvent(_0x3dd8db){return function(_0x4ad5dc,_0x6f6bb2,_0x43fb2e){TeamEvents['emit'](_0x3dd8db+':'+_0x4ad5dc['id'],_0x4ad5dc);TeamEvents[_0x0ebb('0x6')](_0x3dd8db,_0x4ad5dc);_0x43fb2e(null);};}for(var e in events){if(events[_0x0ebb('0x7')](e)){var event=events[e];Team[_0x0ebb('0x8')](e,emitEvent(event));}}module[_0x0ebb('0x9')]=TeamEvents;