Built motion from commit c116dc8b.|2.6.30
[motion2.git] / server / api / faxMessage / faxMessage.model.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 _0xade4=['FaxInteraction','findOne','FaxInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xade4,0xf0));var _0x4ade=function(_0x19696d,_0x232142){_0x19696d=_0x19696d-0x0;var _0x32545f=_0xade4[_0x19696d];return _0x32545f;};'use strict';var _=require(_0x4ade('0x0'));var util=require(_0x4ade('0x1'));var logger=require(_0x4ade('0x2'))(_0x4ade('0x3'));var moment=require(_0x4ade('0x4'));var BPromise=require(_0x4ade('0x5'));var rp=require(_0x4ade('0x6'));var fs=require('fs');var path=require(_0x4ade('0x7'));var rimraf=require(_0x4ade('0x8'));var config=require(_0x4ade('0x9'));var attributes=require(_0x4ade('0xa'));module['exports']=function(_0x505544,_0x3a37e7){return _0x505544['define'](_0x4ade('0xb'),attributes,{'tableName':_0x4ade('0xc'),'paranoid':![],'indexes':[{'name':_0x4ade('0xd'),'fields':[_0x4ade('0xe')],'type':_0x4ade('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x288e8d,_0x5cd274,_0x4ebae4){var _0x68422f=_0x505544['models'];var _0x4e6558=_0x288e8d['get']({'plain':!![]});if(_0x4e6558[_0x4ade('0x10')]['toLowerCase']()==='in'||_0x4e6558['direction'][_0x4ade('0x11')]()===_0x4ade('0x12')&&!_0x4e6558[_0x4ade('0x13')]&&!_[_0x4ade('0x14')](_0x4e6558['UserId'])){_0x68422f[_0x4ade('0x15')][_0x4ade('0x16')]({'where':{'id':_0x4e6558[_0x4ade('0x17')]}})['then'](function(_0x5e5aee){if(_0x5e5aee){_0x5e5aee[_0x4ade('0x18')]({'lastMsgAt':_0x4e6558['createdAt'],'lastMsgDirection':_0x4e6558[_0x4ade('0x10')][_0x4ade('0x11')]()});}})[_0x4ade('0x19')](function(_0x2e70b5){console[_0x4ade('0x1a')](_0x2e70b5);});}_0x4ebae4();}},'charset':_0x4ade('0x1b'),'collate':_0x4ade('0x1c')});};