Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / user / user.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 _0x323f=['../../mysqldb','User','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x15d2e7,_0x50d948){var _0x3bd293=function(_0x169146){while(--_0x169146){_0x15d2e7['push'](_0x15d2e7['shift']());}};_0x3bd293(++_0x50d948);}(_0x323f,0xe7));var _0xf323=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x323f[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xf323('0x0'));var User=require(_0xf323('0x1'))['db'][_0xf323('0x2')];var UserEvents=new EventEmitter();UserEvents[_0xf323('0x3')](0x0);var events={'afterCreate':_0xf323('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x51668b){return function(_0x610d44,_0x5f4042,_0x594d63){UserEvents[_0xf323('0x5')](_0x51668b+':'+_0x610d44['id'],_0x610d44);UserEvents[_0xf323('0x5')](_0x51668b,_0x610d44);_0x594d63(null);};}for(var e in events){if(events[_0xf323('0x6')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module[_0xf323('0x7')]=UserEvents;