Built motion from commit 47436d59.|2.6.7
[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 _0x17a3=['remove','hasOwnProperty','hook','events','../../mysqldb','User','setMaxListeners','update'];(function(_0x4c4c9a,_0x19350f){var _0x27db59=function(_0x3feebf){while(--_0x3feebf){_0x4c4c9a['push'](_0x4c4c9a['shift']());}};_0x27db59(++_0x19350f);}(_0x17a3,0x183));var _0x317a=function(_0x4dd77b,_0x4896d7){_0x4dd77b=_0x4dd77b-0x0;var _0x4eb7c2=_0x17a3[_0x4dd77b];return _0x4eb7c2;};'use strict';var EventEmitter=require(_0x317a('0x0'));var User=require(_0x317a('0x1'))['db'][_0x317a('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x317a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x317a('0x4'),'afterDestroy':_0x317a('0x5')};function emitEvent(_0x5e60bb){return function(_0x106fe9,_0x207369,_0x3d9a1e){UserEvents['emit'](_0x5e60bb+':'+_0x106fe9['id'],_0x106fe9);UserEvents['emit'](_0x5e60bb,_0x106fe9);_0x3d9a1e(null);};}for(var e in events){if(events[_0x317a('0x6')](e)){var event=events[e];User[_0x317a('0x7')](e,emitEvent(event));}}module['exports']=UserEvents;