1b25f6d6977c00813abe0693d5fe127764cb55d1
[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 _0x7f94=['save','update','emit','hasOwnProperty','exports','events','UserProfile','setMaxListeners'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0x7f94,0x65));var _0x47f9=function(_0x53c473,_0x385ee3){_0x53c473=_0x53c473-0x0;var _0x4af0d3=_0x7f94[_0x53c473];return _0x4af0d3;};'use strict';var EventEmitter=require(_0x47f9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x47f9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x47f9('0x2')](0x0);var events={'afterCreate':_0x47f9('0x3'),'afterUpdate':_0x47f9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ae182){return function(_0x1ecb98,_0x146950,_0x1dd1c1){UserProfileEvents[_0x47f9('0x5')](_0x1ae182+':'+_0x1ecb98['id'],_0x1ecb98);UserProfileEvents[_0x47f9('0x5')](_0x1ae182,_0x1ecb98);_0x1dd1c1(null);};}for(var e in events){if(events[_0x47f9('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x47f9('0x7')]=UserProfileEvents;