e9e47a5923216c8a3c4a22da0dd89f7bb6e68e94
[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 _0xce74=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','CmContact'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xce74,0x1ae));var _0x4ce7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xce74[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x4ce7('0x0'));var CmContact=require('../../mysqldb')['db'][_0x4ce7('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x4ce7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ce7('0x3'),'afterDestroy':_0x4ce7('0x4')};function emitEvent(_0x1b7658){return function(_0x3cc17e,_0x3d9132,_0xdb81ba){CmContactEvents[_0x4ce7('0x5')](_0x1b7658+':'+_0x3cc17e['id'],_0x3cc17e);CmContactEvents[_0x4ce7('0x5')](_0x1b7658,_0x3cc17e);_0xdb81ba(null);};}for(var e in events){if(events[_0x4ce7('0x6')](e)){var event=events[e];CmContact[_0x4ce7('0x7')](e,emitEvent(event));}}module[_0x4ce7('0x8')]=CmContactEvents;