Built motion from commit da617fac.|2.6.6
[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 _0xcaf2=['hook','exports','events','UserProfile','setMaxListeners','update','remove','emit'];(function(_0x1fdc80,_0x55985a){var _0x500035=function(_0x15f255){while(--_0x15f255){_0x1fdc80['push'](_0x1fdc80['shift']());}};_0x500035(++_0x55985a);}(_0xcaf2,0x8a));var _0x2caf=function(_0xfe4a8d,_0x33d75d){_0xfe4a8d=_0xfe4a8d-0x0;var _0x1bf633=_0xcaf2[_0xfe4a8d];return _0x1bf633;};'use strict';var EventEmitter=require(_0x2caf('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x2caf('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2caf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2caf('0x3'),'afterDestroy':_0x2caf('0x4')};function emitEvent(_0x5b4a90){return function(_0xb4fae,_0x4d046b,_0x335e3c){UserProfileEvents[_0x2caf('0x5')](_0x5b4a90+':'+_0xb4fae['id'],_0xb4fae);UserProfileEvents[_0x2caf('0x5')](_0x5b4a90,_0xb4fae);_0x335e3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x2caf('0x6')](e,emitEvent(event));}}module[_0x2caf('0x7')]=UserProfileEvents;