1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x95f0=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','FaxInteraction','then','update','createdAt','catch','error','utf8mb4','lodash','util'];(function(_0x387f80,_0x141029){var _0x3bec51=function(_0x419704){while(--_0x419704){_0x387f80['push'](_0x387f80['shift']());}};_0x3bec51(++_0x141029);}(_0x95f0,0x1eb));var _0x095f=function(_0x461be2,_0x38a677){_0x461be2=_0x461be2-0x0;var _0x5edac8=_0x95f0[_0x461be2];return _0x5edac8;};'use strict';var _=require(_0x095f('0x0'));var util=require(_0x095f('0x1'));var logger=require(_0x095f('0x2'))(_0x095f('0x3'));var moment=require(_0x095f('0x4'));var BPromise=require(_0x095f('0x5'));var rp=require(_0x095f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x095f('0x7'));var attributes=require(_0x095f('0x8'));module[_0x095f('0x9')]=function(_0x5fe6b5,_0x2c3775){return _0x5fe6b5[_0x095f('0xa')](_0x095f('0xb'),attributes,{'tableName':_0x095f('0xc'),'paranoid':![],'indexes':[{'name':_0x095f('0xd'),'fields':[_0x095f('0xe')],'type':_0x095f('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22c8ac,_0x179c11,_0x19fa46){var _0x27b74d=_0x5fe6b5[_0x095f('0x10')];var _0x2565ae=_0x22c8ac[_0x095f('0x11')]({'plain':!![]});if(_0x2565ae[_0x095f('0x12')]['toLowerCase']()==='in'||_0x2565ae[_0x095f('0x12')][_0x095f('0x13')]()===_0x095f('0x14')&&!_0x2565ae['secret']&&!_['isNil'](_0x2565ae[_0x095f('0x15')])){_0x27b74d[_0x095f('0x16')]['findOne']({'where':{'id':_0x2565ae['FaxInteractionId']}})[_0x095f('0x17')](function(_0x1bff39){if(_0x1bff39){_0x1bff39[_0x095f('0x18')]({'lastMsgAt':_0x2565ae[_0x095f('0x19')],'lastMsgDirection':_0x2565ae[_0x095f('0x12')][_0x095f('0x13')]()});}})[_0x095f('0x1a')](function(_0x105d9f){console[_0x095f('0x1b')](_0x105d9f);});}_0x19fa46();}},'charset':_0x095f('0x1c'),'collate':'utf8mb4_unicode_ci'});};