Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / cmContact / cmContact.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 _0x5e6d=['events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x6b0451,_0x266f96){var _0x1eb6d5=function(_0x3c2d53){while(--_0x3c2d53){_0x6b0451['push'](_0x6b0451['shift']());}};_0x1eb6d5(++_0x266f96);}(_0x5e6d,0x12c));var _0xd5e6=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x5e6d[_0x5834bc];return _0x3e183a;};'use strict';var EventEmitter=require(_0xd5e6('0x0'));var CmContact=require(_0xd5e6('0x1'))['db'][_0xd5e6('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xd5e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd5e6('0x4'),'afterDestroy':_0xd5e6('0x5')};function emitEvent(_0x2ff856){return function(_0x5853f7,_0x45876b,_0x373841){CmContactEvents[_0xd5e6('0x6')](_0x2ff856+':'+_0x5853f7['id'],_0x5853f7);CmContactEvents[_0xd5e6('0x6')](_0x2ff856,_0x5853f7);_0x373841(null);};}for(var e in events){if(events[_0xd5e6('0x7')](e)){var event=events[e];CmContact[_0xd5e6('0x8')](e,emitEvent(event));}}module[_0xd5e6('0x9')]=CmContactEvents;