0fe9bb908d1ef6c1c69fe4cde70b364293d1bb7b
[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 _0xa618=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','User','setMaxListeners','save','update'];(function(_0x41e6b5,_0x4e9771){var _0x1eb88a=function(_0xd80992){while(--_0xd80992){_0x41e6b5['push'](_0x41e6b5['shift']());}};_0x1eb88a(++_0x4e9771);}(_0xa618,0xf4));var _0x8a61=function(_0xa16095,_0x16b3a1){_0xa16095=_0xa16095-0x0;var _0x55ab6d=_0xa618[_0xa16095];return _0x55ab6d;};'use strict';var EventEmitter=require(_0x8a61('0x0'));var User=require(_0x8a61('0x1'))['db'][_0x8a61('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x8a61('0x3')](0x0);var events={'afterCreate':_0x8a61('0x4'),'afterUpdate':_0x8a61('0x5'),'afterDestroy':_0x8a61('0x6')};function emitEvent(_0x163f9a){return function(_0x2f95e3,_0x415751,_0x43c33f){UserEvents[_0x8a61('0x7')](_0x163f9a+':'+_0x2f95e3['id'],_0x2f95e3);UserEvents[_0x8a61('0x7')](_0x163f9a,_0x2f95e3);_0x43c33f(null);};}for(var e in events){if(events[_0x8a61('0x8')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module[_0x8a61('0x9')]=UserEvents;