Built motion from commit (unavailable).|2.5.15
[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 _0x7744=['api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7744,0x112));var _0x4774=function(_0x55e45c,_0x3fd637){_0x55e45c=_0x55e45c-0x0;var _0x5d304e=_0x7744[_0x55e45c];return _0x5d304e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4774('0x0'))(_0x4774('0x1'));var moment=require(_0x4774('0x2'));var BPromise=require(_0x4774('0x3'));var rp=require(_0x4774('0x4'));var fs=require('fs');var path=require(_0x4774('0x5'));var rimraf=require('rimraf');var config=require(_0x4774('0x6'));var attributes=require(_0x4774('0x7'));module['exports']=function(_0x2545f8,_0x1665c9){return _0x2545f8[_0x4774('0x8')]('FaxMessage',attributes,{'tableName':_0x4774('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x4774('0xa')],'type':_0x4774('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x211c26,_0x28d321,_0xc27c07){var _0x34a2f8=_0x2545f8[_0x4774('0xc')];var _0x378dcc=_0x211c26['get']({'plain':!![]});if(_0x378dcc[_0x4774('0xd')][_0x4774('0xe')]()==='in'||_0x378dcc[_0x4774('0xd')]['toLowerCase']()===_0x4774('0xf')&&!_0x378dcc[_0x4774('0x10')]&&!_[_0x4774('0x11')](_0x378dcc[_0x4774('0x12')])){_0x34a2f8['FaxInteraction']['findOne']({'where':{'id':_0x378dcc[_0x4774('0x13')]}})[_0x4774('0x14')](function(_0x2e39c2){if(_0x2e39c2){_0x2e39c2[_0x4774('0x15')]({'lastMsgAt':_0x378dcc[_0x4774('0x16')],'lastMsgDirection':_0x378dcc[_0x4774('0xd')][_0x4774('0xe')]()});}})['catch'](function(_0x563620){console['error'](_0x563620);});}_0xc27c07();}},'charset':_0x4774('0x17'),'collate':_0x4774('0x18')});};