d1ca291d00176185812c52578d04fc8569fc01ba
[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 _0xd8ac=['save','remove','emit','hook','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x3e7be5,_0x388fc5){var _0x16522e=function(_0x555238){while(--_0x555238){_0x3e7be5['push'](_0x3e7be5['shift']());}};_0x16522e(++_0x388fc5);}(_0xd8ac,0x1eb));var _0xcd8a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd8ac[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0xcd8a('0x0'));var CmContact=require(_0xcd8a('0x1'))['db'][_0xcd8a('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xcd8a('0x3')](0x0);var events={'afterCreate':_0xcd8a('0x4'),'afterUpdate':'update','afterDestroy':_0xcd8a('0x5')};function emitEvent(_0x323127){return function(_0x3f0680,_0x3c1f80,_0x4bd047){CmContactEvents['emit'](_0x323127+':'+_0x3f0680['id'],_0x3f0680);CmContactEvents[_0xcd8a('0x6')](_0x323127,_0x3f0680);_0x4bd047(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xcd8a('0x7')](e,emitEvent(event));}}module[_0xcd8a('0x8')]=CmContactEvents;