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 _0x7fe4=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxMessage','body','FULLTEXT','models','toLowerCase','direction','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt'];(function(_0x228932,_0x23509a){var _0x56929b=function(_0x4199e1){while(--_0x4199e1){_0x228932['push'](_0x228932['shift']());}};_0x56929b(++_0x23509a);}(_0x7fe4,0x107));var _0x47fe=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7fe4[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x47fe('0x0'));var util=require(_0x47fe('0x1'));var logger=require('../../config/logger')(_0x47fe('0x2'));var moment=require(_0x47fe('0x3'));var BPromise=require(_0x47fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47fe('0x5'));var rimraf=require(_0x47fe('0x6'));var config=require(_0x47fe('0x7'));var attributes=require('./faxMessage.attributes');module[_0x47fe('0x8')]=function(_0x4d7473,_0x304cf4){return _0x4d7473[_0x47fe('0x9')](_0x47fe('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x47fe('0xb')],'type':_0x47fe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55d112,_0x4b08e1,_0x438764){var _0x4f675a=_0x4d7473[_0x47fe('0xd')];var _0x2fa00b=_0x55d112['get']({'plain':!![]});if(_0x2fa00b['direction'][_0x47fe('0xe')]()==='in'||_0x2fa00b[_0x47fe('0xf')]['toLowerCase']()==='out'&&!_0x2fa00b['secret']&&!_[_0x47fe('0x10')](_0x2fa00b[_0x47fe('0x11')])){_0x4f675a['FaxInteraction'][_0x47fe('0x12')]({'where':{'id':_0x2fa00b[_0x47fe('0x13')]}})[_0x47fe('0x14')](function(_0x3ed203){if(_0x3ed203){_0x3ed203[_0x47fe('0x15')]({'lastMsgAt':_0x2fa00b[_0x47fe('0x16')],'lastMsgDirection':_0x2fa00b[_0x47fe('0xf')][_0x47fe('0xe')]()});}})['catch'](function(_0xa57761){console[_0x47fe('0x17')](_0xa57761);});}_0x438764();}},'charset':_0x47fe('0x18'),'collate':_0x47fe('0x19')});};