Built motion from commit 9d7072cc.|2.5.39
[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 _0xfef5=['bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x3800da,_0x5c3cb7){var _0x12cb80=function(_0x1a5120){while(--_0x1a5120){_0x3800da['push'](_0x3800da['shift']());}};_0x12cb80(++_0x5c3cb7);}(_0xfef5,0x181));var _0x5fef=function(_0x22ac79,_0xd7cd5e){_0x22ac79=_0x22ac79-0x0;var _0x249ac4=_0xfef5[_0x22ac79];return _0x249ac4;};'use strict';var _=require(_0x5fef('0x0'));var util=require(_0x5fef('0x1'));var logger=require(_0x5fef('0x2'))(_0x5fef('0x3'));var moment=require(_0x5fef('0x4'));var BPromise=require(_0x5fef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fef('0x6'));var rimraf=require(_0x5fef('0x7'));var config=require(_0x5fef('0x8'));var attributes=require(_0x5fef('0x9'));module[_0x5fef('0xa')]=function(_0x10f079,_0x4db102){return _0x10f079[_0x5fef('0xb')](_0x5fef('0xc'),attributes,{'tableName':_0x5fef('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x5fef('0xe')],'type':_0x5fef('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8b128c,_0x3ffe2a,_0x2000c2){var _0x2acaf1=_0x10f079['models'];var _0x549934=_0x8b128c[_0x5fef('0x10')]({'plain':!![]});if(_0x549934[_0x5fef('0x11')][_0x5fef('0x12')]()==='in'||_0x549934[_0x5fef('0x11')][_0x5fef('0x12')]()===_0x5fef('0x13')&&!_0x549934[_0x5fef('0x14')]&&!_['isNil'](_0x549934['UserId'])){_0x2acaf1[_0x5fef('0x15')][_0x5fef('0x16')]({'where':{'id':_0x549934[_0x5fef('0x17')]}})[_0x5fef('0x18')](function(_0x57edd5){if(_0x57edd5){_0x57edd5[_0x5fef('0x19')]({'lastMsgAt':_0x549934[_0x5fef('0x1a')],'lastMsgDirection':_0x549934[_0x5fef('0x11')]['toLowerCase']()});}})[_0x5fef('0x1b')](function(_0x20b678){console[_0x5fef('0x1c')](_0x20b678);});}_0x2000c2();}},'charset':_0x5fef('0x1d'),'collate':'utf8mb4_unicode_ci'});};