Built motion from commit (unavailable).|2.5.14
[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 _0x89fb=['emit','hasOwnProperty','exports','../../mysqldb','User','setMaxListeners','save','update'];(function(_0x40db9a,_0x210b5c){var _0x49f14f=function(_0xcdf9f6){while(--_0xcdf9f6){_0x40db9a['push'](_0x40db9a['shift']());}};_0x49f14f(++_0x210b5c);}(_0x89fb,0x14b));var _0xb89f=function(_0x215c99,_0x485dc4){_0x215c99=_0x215c99-0x0;var _0x3d9122=_0x89fb[_0x215c99];return _0x3d9122;};'use strict';var EventEmitter=require('events');var User=require(_0xb89f('0x0'))['db'][_0xb89f('0x1')];var UserEvents=new EventEmitter();UserEvents[_0xb89f('0x2')](0x0);var events={'afterCreate':_0xb89f('0x3'),'afterUpdate':_0xb89f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x358c4d){return function(_0xa626e8,_0x3d0629,_0x34c4ce){UserEvents[_0xb89f('0x5')](_0x358c4d+':'+_0xa626e8['id'],_0xa626e8);UserEvents['emit'](_0x358c4d,_0xa626e8);_0x34c4ce(null);};}for(var e in events){if(events[_0xb89f('0x6')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module[_0xb89f('0x7')]=UserEvents;