Built motion from commit (unavailable).|2.5.13
[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 _0x078a=['exports','events','../../mysqldb','User','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x078a,0x12d));var _0xa078=function(_0x3a913b,_0x5893fe){_0x3a913b=_0x3a913b-0x0;var _0x161c97=_0x078a[_0x3a913b];return _0x161c97;};'use strict';var EventEmitter=require(_0xa078('0x0'));var User=require(_0xa078('0x1'))['db'][_0xa078('0x2')];var UserEvents=new EventEmitter();UserEvents[_0xa078('0x3')](0x0);var events={'afterCreate':_0xa078('0x4'),'afterUpdate':_0xa078('0x5'),'afterDestroy':'remove'};function emitEvent(_0x267649){return function(_0x44af33,_0x2f4616,_0x51963f){UserEvents[_0xa078('0x6')](_0x267649+':'+_0x44af33['id'],_0x44af33);UserEvents['emit'](_0x267649,_0x44af33);_0x51963f(null);};}for(var e in events){if(events[_0xa078('0x7')](e)){var event=events[e];User[_0xa078('0x8')](e,emitEvent(event));}}module[_0xa078('0x9')]=UserEvents;