Built motion from commit 85328c08.|2.5.50
[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 _0x5f77=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5f77,0xe2));var _0x75f7=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x5f77[_0x576170];return _0x397c70;};'use strict';var EventEmitter=require(_0x75f7('0x0'));var User=require(_0x75f7('0x1'))['db']['User'];var UserEvents=new EventEmitter();UserEvents[_0x75f7('0x2')](0x0);var events={'afterCreate':_0x75f7('0x3'),'afterUpdate':_0x75f7('0x4'),'afterDestroy':_0x75f7('0x5')};function emitEvent(_0x2c6ae7){return function(_0x341d2e,_0x2da689,_0x207d2e){UserEvents[_0x75f7('0x6')](_0x2c6ae7+':'+_0x341d2e['id'],_0x341d2e);UserEvents[_0x75f7('0x6')](_0x2c6ae7,_0x341d2e);_0x207d2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];User[_0x75f7('0x7')](e,emitEvent(event));}}module[_0x75f7('0x8')]=UserEvents;