Built motion from commit 19a84241.|2.5.34
[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 _0x60c5=['exports','save','remove','emit','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60c5,0x8d));var _0x560c=function(_0x43afc5,_0x269397){_0x43afc5=_0x43afc5-0x0;var _0x48f240=_0x60c5[_0x43afc5];return _0x48f240;};'use strict';var EventEmitter=require('events');var User=require('../../mysqldb')['db']['User'];var UserEvents=new EventEmitter();UserEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x560c('0x0'),'afterUpdate':'update','afterDestroy':_0x560c('0x1')};function emitEvent(_0x132e80){return function(_0x16da60,_0x57c821,_0x133820){UserEvents['emit'](_0x132e80+':'+_0x16da60['id'],_0x16da60);UserEvents[_0x560c('0x2')](_0x132e80,_0x16da60);_0x133820(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];User[_0x560c('0x3')](e,emitEvent(event));}}module[_0x560c('0x4')]=UserEvents;