Built motion from commit 14588770.|2.5.38
[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 _0x77c4=['emit','hook','User','setMaxListeners','update'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x77c4,0xe3));var _0x477c=function(_0x1efd6a,_0x2234e0){_0x1efd6a=_0x1efd6a-0x0;var _0x1890db=_0x77c4[_0x1efd6a];return _0x1890db;};'use strict';var EventEmitter=require('events');var User=require('../../mysqldb')['db'][_0x477c('0x0')];var UserEvents=new EventEmitter();UserEvents[_0x477c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x477c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x58204b){return function(_0x1d5ab8,_0x2de444,_0x571070){UserEvents[_0x477c('0x3')](_0x58204b+':'+_0x1d5ab8['id'],_0x1d5ab8);UserEvents[_0x477c('0x3')](_0x58204b,_0x1d5ab8);_0x571070(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];User[_0x477c('0x4')](e,emitEvent(event));}}module['exports']=UserEvents;