Built motion from commit 1fa89557.|2.6.10
[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 _0x37e8=['exports','events','../../mysqldb','User','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x74552c,_0x51ce06){var _0xfc27d7=function(_0x1fa991){while(--_0x1fa991){_0x74552c['push'](_0x74552c['shift']());}};_0xfc27d7(++_0x51ce06);}(_0x37e8,0xc9));var _0x837e=function(_0x4de306,_0x9ac209){_0x4de306=_0x4de306-0x0;var _0x34c528=_0x37e8[_0x4de306];return _0x34c528;};'use strict';var EventEmitter=require(_0x837e('0x0'));var User=require(_0x837e('0x1'))['db'][_0x837e('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x837e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x837e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5ec6af){return function(_0x2f2a6e,_0x1f0054,_0x15b56b){UserEvents[_0x837e('0x5')](_0x5ec6af+':'+_0x2f2a6e['id'],_0x2f2a6e);UserEvents['emit'](_0x5ec6af,_0x2f2a6e);_0x15b56b(null);};}for(var e in events){if(events[_0x837e('0x6')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module[_0x837e('0x7')]=UserEvents;