Built motion from commit 5ae82ce5.|2.6.7
[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 _0xa643=['path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','then','update','createdAt','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1d02e4,_0x70ad69){var _0x1fecbe=function(_0x14f637){while(--_0x14f637){_0x1d02e4['push'](_0x1d02e4['shift']());}};_0x1fecbe(++_0x70ad69);}(_0xa643,0xa9));var _0x3a64=function(_0x1062c2,_0x2bd58a){_0x1062c2=_0x1062c2-0x0;var _0x271448=_0xa643[_0x1062c2];return _0x271448;};'use strict';var _=require(_0x3a64('0x0'));var util=require(_0x3a64('0x1'));var logger=require('../../config/logger')(_0x3a64('0x2'));var moment=require(_0x3a64('0x3'));var BPromise=require(_0x3a64('0x4'));var rp=require(_0x3a64('0x5'));var fs=require('fs');var path=require(_0x3a64('0x6'));var rimraf=require(_0x3a64('0x7'));var config=require(_0x3a64('0x8'));var attributes=require(_0x3a64('0x9'));module[_0x3a64('0xa')]=function(_0xdb084c,_0x5045a0){return _0xdb084c['define']('FaxMessage',attributes,{'tableName':_0x3a64('0xb'),'paranoid':![],'indexes':[{'name':_0x3a64('0xc'),'fields':[_0x3a64('0xd')],'type':_0x3a64('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x445f09,_0x288f3f,_0xc30326){var _0x337dca=_0xdb084c['models'];var _0x991676=_0x445f09[_0x3a64('0xf')]({'plain':!![]});if(_0x991676['direction'][_0x3a64('0x10')]()==='in'||_0x991676[_0x3a64('0x11')]['toLowerCase']()==='out'&&!_0x991676[_0x3a64('0x12')]&&!_[_0x3a64('0x13')](_0x991676['UserId'])){_0x337dca['FaxInteraction']['findOne']({'where':{'id':_0x991676['FaxInteractionId']}})[_0x3a64('0x14')](function(_0x1e56c9){if(_0x1e56c9){_0x1e56c9[_0x3a64('0x15')]({'lastMsgAt':_0x991676[_0x3a64('0x16')],'lastMsgDirection':_0x991676[_0x3a64('0x11')][_0x3a64('0x10')]()});}})['catch'](function(_0x222f1c){console[_0x3a64('0x17')](_0x222f1c);});}_0xc30326();}},'charset':_0x3a64('0x18'),'collate':'utf8mb4_unicode_ci'});};