06cc70fdf3536a973811d023720d556f91224338
[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 _0x7c53=['emit','hook','exports','userNotification','save','update'];(function(_0x580b01,_0x2c3619){var _0x19f193=function(_0x3dffbc){while(--_0x3dffbc){_0x580b01['push'](_0x580b01['shift']());}};_0x19f193(++_0x2c3619);}(_0x7c53,0xf9));var _0x37c5=function(_0x21b3fc,_0x4a5812){_0x21b3fc=_0x21b3fc-0x0;var _0x47adba=_0x7c53[_0x21b3fc];return _0x47adba;};'use strict';var EventEmitter=require('events');var userNotification=require('../../mysqldb')['db'][_0x37c5('0x0')];var userNotificationEvents=new EventEmitter();userNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x37c5('0x1'),'afterUpdate':_0x37c5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5e35ff){return function(_0x36500b,_0x1651ba,_0x4831b2){userNotificationEvents[_0x37c5('0x3')](_0x5e35ff+':'+_0x36500b['id'],_0x36500b);userNotificationEvents[_0x37c5('0x3')](_0x5e35ff,_0x36500b);_0x4831b2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];userNotification[_0x37c5('0x4')](e,emitEvent(event));}}module[_0x37c5('0x5')]=userNotificationEvents;