Built motion from commit (unavailable).|2.5.29
[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 _0xfb67=['exports','events','../../mysqldb','User','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3abb6c,_0x2765bb){var _0x4eb220=function(_0x436493){while(--_0x436493){_0x3abb6c['push'](_0x3abb6c['shift']());}};_0x4eb220(++_0x2765bb);}(_0xfb67,0xdd));var _0x7fb6=function(_0x3958f5,_0x38700f){_0x3958f5=_0x3958f5-0x0;var _0x20e1e0=_0xfb67[_0x3958f5];return _0x20e1e0;};'use strict';var EventEmitter=require(_0x7fb6('0x0'));var User=require(_0x7fb6('0x1'))['db'][_0x7fb6('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x7fb6('0x3')](0x0);var events={'afterCreate':_0x7fb6('0x4'),'afterUpdate':_0x7fb6('0x5'),'afterDestroy':_0x7fb6('0x6')};function emitEvent(_0x5db5cf){return function(_0x40c3ce,_0x29dadc,_0x1c528e){UserEvents[_0x7fb6('0x7')](_0x5db5cf+':'+_0x40c3ce['id'],_0x40c3ce);UserEvents[_0x7fb6('0x7')](_0x5db5cf,_0x40c3ce);_0x1c528e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];User[_0x7fb6('0x8')](e,emitEvent(event));}}module[_0x7fb6('0x9')]=UserEvents;