2eb46871caf66c8d60936aefa752f88db84ce4d4
[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 _0x627e=['events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x627e,0x14a));var _0xe627=function(_0x2333c2,_0x2da0ad){_0x2333c2=_0x2333c2-0x0;var _0x557550=_0x627e[_0x2333c2];return _0x557550;};'use strict';var EventEmitter=require(_0xe627('0x0'));var UserProfile=require(_0xe627('0x1'))['db'][_0xe627('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe627('0x3')](0x0);var events={'afterCreate':_0xe627('0x4'),'afterUpdate':'update','afterDestroy':_0xe627('0x5')};function emitEvent(_0x328881){return function(_0x2abdc7,_0x59a2c8,_0x52923f){UserProfileEvents['emit'](_0x328881+':'+_0x2abdc7['id'],_0x2abdc7);UserProfileEvents[_0xe627('0x6')](_0x328881,_0x2abdc7);_0x52923f(null);};}for(var e in events){if(events[_0xe627('0x7')](e)){var event=events[e];UserProfile[_0xe627('0x8')](e,emitEvent(event));}}module[_0xe627('0x9')]=UserProfileEvents;