Built motion from commit f6d7e26c.|2.6.14
[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 _0xe006=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','User','setMaxListeners'];(function(_0x172a4a,_0x3a0b30){var _0x560151=function(_0x740373){while(--_0x740373){_0x172a4a['push'](_0x172a4a['shift']());}};_0x560151(++_0x3a0b30);}(_0xe006,0x167));var _0x6e00=function(_0x45d31c,_0xd0b936){_0x45d31c=_0x45d31c-0x0;var _0x33c23a=_0xe006[_0x45d31c];return _0x33c23a;};'use strict';var EventEmitter=require(_0x6e00('0x0'));var User=require(_0x6e00('0x1'))['db'][_0x6e00('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x6e00('0x3')](0x0);var events={'afterCreate':_0x6e00('0x4'),'afterUpdate':_0x6e00('0x5'),'afterDestroy':_0x6e00('0x6')};function emitEvent(_0x5afd46){return function(_0x528002,_0x4f324c,_0x5481f1){UserEvents[_0x6e00('0x7')](_0x5afd46+':'+_0x528002['id'],_0x528002);UserEvents['emit'](_0x5afd46,_0x528002);_0x5481f1(null);};}for(var e in events){if(events[_0x6e00('0x8')](e)){var event=events[e];User[_0x6e00('0x9')](e,emitEvent(event));}}module[_0x6e00('0xa')]=UserEvents;