d196a0cd793d15bb72af79097da8aa9bfe787694
[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(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x627e,0x14a));var _0xe627=function(_0xd7c52d,_0x4c7ef4){_0xd7c52d=_0xd7c52d-0x0;var _0x141ddd=_0x627e[_0xd7c52d];return _0x141ddd;};'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;