Built motion from commit 3770a7bd.|2.6.29
[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 _0xc16b=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x126786,_0x14eef2){var _0x3d061a=function(_0x4f521c){while(--_0x4f521c){_0x126786['push'](_0x126786['shift']());}};_0x3d061a(++_0x14eef2);}(_0xc16b,0x125));var _0xbc16=function(_0x5a1c3e,_0x4ccf1b){_0x5a1c3e=_0x5a1c3e-0x0;var _0x391ad9=_0xc16b[_0x5a1c3e];return _0x391ad9;};'use strict';var EventEmitter=require(_0xbc16('0x0'));var CmContact=require(_0xbc16('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xbc16('0x2')](0x0);var events={'afterCreate':_0xbc16('0x3'),'afterUpdate':'update','afterDestroy':_0xbc16('0x4')};function emitEvent(_0x5aadb2){return function(_0x206d4d,_0x520b5c,_0x5bdfc5){CmContactEvents['emit'](_0x5aadb2+':'+_0x206d4d['id'],_0x206d4d);CmContactEvents[_0xbc16('0x5')](_0x5aadb2,_0x206d4d);_0x5bdfc5(null);};}for(var e in events){if(events[_0xbc16('0x6')](e)){var event=events[e];CmContact[_0xbc16('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents;