Built motion from commit (unavailable).|2.5.27
[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 _0x341c=['update','remove','emit','hasOwnProperty','hook','exports','events','User','save'];(function(_0x1d8bc2,_0x2e6c47){var _0x55420d=function(_0x4af6af){while(--_0x4af6af){_0x1d8bc2['push'](_0x1d8bc2['shift']());}};_0x55420d(++_0x2e6c47);}(_0x341c,0xcc));var _0xc341=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0x341c[_0x446e61];return _0x4160a8;};'use strict';var EventEmitter=require(_0xc341('0x0'));var User=require('../../mysqldb')['db'][_0xc341('0x1')];var UserEvents=new EventEmitter();UserEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc341('0x2'),'afterUpdate':_0xc341('0x3'),'afterDestroy':_0xc341('0x4')};function emitEvent(_0x40d92f){return function(_0x4c74c5,_0x3e07f8,_0x3ab689){UserEvents[_0xc341('0x5')](_0x40d92f+':'+_0x4c74c5['id'],_0x4c74c5);UserEvents['emit'](_0x40d92f,_0x4c74c5);_0x3ab689(null);};}for(var e in events){if(events[_0xc341('0x6')](e)){var event=events[e];User[_0xc341('0x7')](e,emitEvent(event));}}module[_0xc341('0x8')]=UserEvents;