028b5ce40fa2038bf66807855fa13d7112e526c6
[motion2.git] / server / api / userNotification / userNotification.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 _0x93d8=['emit','hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners','save','update'];(function(_0x5dbaa7,_0x1f6d4a){var _0x481319=function(_0x116e27){while(--_0x116e27){_0x5dbaa7['push'](_0x5dbaa7['shift']());}};_0x481319(++_0x1f6d4a);}(_0x93d8,0x148));var _0x893d=function(_0x1c3168,_0x49d04c){_0x1c3168=_0x1c3168-0x0;var _0xc78b3c=_0x93d8[_0x1c3168];return _0xc78b3c;};'use strict';var EventEmitter=require(_0x893d('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x893d('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x893d('0x2')](0x0);var events={'afterCreate':_0x893d('0x3'),'afterUpdate':_0x893d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x32147e){return function(_0x1f465e,_0x364c8f,_0x50fb3e){UserNotificationEvents[_0x893d('0x5')](_0x32147e+':'+_0x1f465e['id'],_0x1f465e);UserNotificationEvents[_0x893d('0x5')](_0x32147e,_0x1f465e);_0x50fb3e(null);};}for(var e in events){if(events[_0x893d('0x6')](e)){var event=events[e];UserNotification[_0x893d('0x7')](e,emitEvent(event));}}module[_0x893d('0x8')]=UserNotificationEvents;