662295c79f7c5ba954c68d7271d83e75fd1c9a16
[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 _0x4bd3=['events','UserProfile','setMaxListeners','emit','hook','exports'];(function(_0x2d7605,_0x5ad4ca){var _0x2410f2=function(_0x1a6e8f){while(--_0x1a6e8f){_0x2d7605['push'](_0x2d7605['shift']());}};_0x2410f2(++_0x5ad4ca);}(_0x4bd3,0x174));var _0x34bd=function(_0x1b8e34,_0x427436){_0x1b8e34=_0x1b8e34-0x0;var _0xb2ded4=_0x4bd3[_0x1b8e34];return _0xb2ded4;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x34bd('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){UserProfileEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);UserProfileEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=UserProfileEvents;