Built motion from commit f7863d46.|2.5.41
[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 _0xa350=['../../mysqldb','User','save','update','remove','emit','hasOwnProperty','events'];(function(_0x4a36a7,_0x11878e){var _0xbc7292=function(_0x5a2534){while(--_0x5a2534){_0x4a36a7['push'](_0x4a36a7['shift']());}};_0xbc7292(++_0x11878e);}(_0xa350,0x16f));var _0x0a35=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa350[_0x599f41];return _0x2e4d58;};'use strict';var EventEmitter=require(_0x0a35('0x0'));var User=require(_0x0a35('0x1'))['db'][_0x0a35('0x2')];var UserEvents=new EventEmitter();UserEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a35('0x3'),'afterUpdate':_0x0a35('0x4'),'afterDestroy':_0x0a35('0x5')};function emitEvent(_0x657582){return function(_0xb94374,_0x22f08b,_0x1d5282){UserEvents['emit'](_0x657582+':'+_0xb94374['id'],_0xb94374);UserEvents[_0x0a35('0x6')](_0x657582,_0xb94374);_0x1d5282(null);};}for(var e in events){if(events[_0x0a35('0x7')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module['exports']=UserEvents;