Built motion from commit (unavailable).|2.5.11
[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 _0xf562=['save','update','remove','emit','hook','exports','events','../../mysqldb','User','setMaxListeners'];(function(_0x4e1f5a,_0x3ceef7){var _0x808d9c=function(_0x54e41f){while(--_0x54e41f){_0x4e1f5a['push'](_0x4e1f5a['shift']());}};_0x808d9c(++_0x3ceef7);}(_0xf562,0x100));var _0x2f56=function(_0x40e910,_0x45fc4b){_0x40e910=_0x40e910-0x0;var _0x292766=_0xf562[_0x40e910];return _0x292766;};'use strict';var EventEmitter=require(_0x2f56('0x0'));var User=require(_0x2f56('0x1'))['db'][_0x2f56('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x2f56('0x3')](0x0);var events={'afterCreate':_0x2f56('0x4'),'afterUpdate':_0x2f56('0x5'),'afterDestroy':_0x2f56('0x6')};function emitEvent(_0x217301){return function(_0x38a249,_0x55a78f,_0x29e08d){UserEvents['emit'](_0x217301+':'+_0x38a249['id'],_0x38a249);UserEvents[_0x2f56('0x7')](_0x217301,_0x38a249);_0x29e08d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];User[_0x2f56('0x8')](e,emitEvent(event));}}module[_0x2f56('0x9')]=UserEvents;