Built motion from commit e0fa946e.|2.6.5
[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 _0xae0d=['../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','utf8mb4','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ab687,_0x2f3a18){var _0x512596=function(_0x981ef2){while(--_0x981ef2){_0x3ab687['push'](_0x3ab687['shift']());}};_0x512596(++_0x2f3a18);}(_0xae0d,0xd1));var _0xdae0=function(_0x1103fc,_0x4638fa){_0x1103fc=_0x1103fc-0x0;var _0x5197c8=_0xae0d[_0x1103fc];return _0x5197c8;};'use strict';var _=require(_0xdae0('0x0'));var util=require(_0xdae0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdae0('0x2'));var BPromise=require(_0xdae0('0x3'));var rp=require(_0xdae0('0x4'));var fs=require('fs');var path=require(_0xdae0('0x5'));var rimraf=require(_0xdae0('0x6'));var config=require(_0xdae0('0x7'));var attributes=require(_0xdae0('0x8'));module[_0xdae0('0x9')]=function(_0x5362b3,_0x332c16){return _0x5362b3[_0xdae0('0xa')](_0xdae0('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xdae0('0xc'),'fields':['body'],'type':_0xdae0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa7bd42,_0x1db853,_0x1ecfd9){var _0x3ba3db=_0x5362b3[_0xdae0('0xe')];var _0x21e4e5=_0xa7bd42[_0xdae0('0xf')]({'plain':!![]});if(_0x21e4e5['direction'][_0xdae0('0x10')]()==='in'||_0x21e4e5[_0xdae0('0x11')][_0xdae0('0x10')]()==='out'&&!_0x21e4e5[_0xdae0('0x12')]&&!_[_0xdae0('0x13')](_0x21e4e5[_0xdae0('0x14')])){_0x3ba3db[_0xdae0('0x15')][_0xdae0('0x16')]({'where':{'id':_0x21e4e5[_0xdae0('0x17')]}})[_0xdae0('0x18')](function(_0x10e069){if(_0x10e069){_0x10e069['update']({'lastMsgAt':_0x21e4e5[_0xdae0('0x19')],'lastMsgDirection':_0x21e4e5['direction'][_0xdae0('0x10')]()});}})['catch'](function(_0x302f85){console['error'](_0x302f85);});}_0x1ecfd9();}},'charset':_0xdae0('0x1a'),'collate':'utf8mb4_unicode_ci'});};