1adc03778461d4d6f0025b90ce27a8573c4d7cc6
[motion2.git] / server / api / user / user.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 _0x068f=['hook','exports','events','User','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1b81ae,_0x1941f7){var _0x33ba48=function(_0x1d6bb0){while(--_0x1d6bb0){_0x1b81ae['push'](_0x1b81ae['shift']());}};_0x33ba48(++_0x1941f7);}(_0x068f,0xf5));var _0xf068=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x068f[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0xf068('0x0'));var User=require('../../mysqldb')['db'][_0xf068('0x1')];var UserEvents=new EventEmitter();UserEvents[_0xf068('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf068('0x3'),'afterDestroy':_0xf068('0x4')};function emitEvent(_0x2d7401){return function(_0x8a91b,_0x44e5d8,_0x634d77){UserEvents[_0xf068('0x5')](_0x2d7401+':'+_0x8a91b['id'],_0x8a91b);UserEvents[_0xf068('0x5')](_0x2d7401,_0x8a91b);_0x634d77(null);};}for(var e in events){if(events[_0xf068('0x6')](e)){var event=events[e];User[_0xf068('0x7')](e,emitEvent(event));}}module[_0xf068('0x8')]=UserEvents;