6fd524e97faf61a8dec9a5b338a3d830e5620a8a
[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 _0xf2c4=['exports','User','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3a3220,_0x55e7f3){var _0x4c2641=function(_0x41859c){while(--_0x41859c){_0x3a3220['push'](_0x3a3220['shift']());}};_0x4c2641(++_0x55e7f3);}(_0xf2c4,0x106));var _0x4f2c=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xf2c4[_0x172747];return _0x509692;};'use strict';var EventEmitter=require('events');var User=require('../../mysqldb')['db'][_0x4f2c('0x0')];var UserEvents=new EventEmitter();UserEvents[_0x4f2c('0x1')](0x0);var events={'afterCreate':_0x4f2c('0x2'),'afterUpdate':_0x4f2c('0x3'),'afterDestroy':_0x4f2c('0x4')};function emitEvent(_0x4cb9f1){return function(_0x5bde03,_0x1660f9,_0x177db7){UserEvents['emit'](_0x4cb9f1+':'+_0x5bde03['id'],_0x5bde03);UserEvents[_0x4f2c('0x5')](_0x4cb9f1,_0x5bde03);_0x177db7(null);};}for(var e in events){if(events[_0x4f2c('0x6')](e)){var event=events[e];User[_0x4f2c('0x7')](e,emitEvent(event));}}module[_0x4f2c('0x8')]=UserEvents;