e8e792dcee27a21bfb860b3e20fbd45dce060b9a
[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 _0xa371=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x852d48,_0x177530){var _0xfc6d52=function(_0x2491f8){while(--_0x2491f8){_0x852d48['push'](_0x852d48['shift']());}};_0xfc6d52(++_0x177530);}(_0xa371,0xbc));var _0x1a37=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xa371[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require(_0x1a37('0x0'));var Team=require(_0x1a37('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x1a37('0x2')](0x0);var events={'afterCreate':_0x1a37('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49a813){return function(_0x1fd6b2,_0x250c6b,_0x4c22d5){TeamEvents[_0x1a37('0x4')](_0x49a813+':'+_0x1fd6b2['id'],_0x1fd6b2);TeamEvents[_0x1a37('0x4')](_0x49a813,_0x1fd6b2);_0x4c22d5(null);};}for(var e in events){if(events[_0x1a37('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x1a37('0x6')]=TeamEvents;