934c9b877b70d618be56c2547d40d054db592704
[motion2.git] / server / api / userProfile / userProfile.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 _0x1b9b=['exports','events','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x12f8c6,_0x54d2d8){var _0xe9ae4a=function(_0x2d5b63){while(--_0x2d5b63){_0x12f8c6['push'](_0x12f8c6['shift']());}};_0xe9ae4a(++_0x54d2d8);}(_0x1b9b,0x89));var _0xb1b9=function(_0x27820c,_0x551bd2){_0x27820c=_0x27820c-0x0;var _0x454e30=_0x1b9b[_0x27820c];return _0x454e30;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb1b9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){UserProfileEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);UserProfileEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=UserProfileEvents;