Built motion from commit 19a84241.|2.5.34
[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 _0xb035=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0xb035,0x179));var _0x5b03=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0xb035[_0x8a30cf];return _0x20f439;};'use strict';var _=require('lodash');var util=require(_0x5b03('0x0'));var logger=require(_0x5b03('0x1'))(_0x5b03('0x2'));var moment=require(_0x5b03('0x3'));var BPromise=require(_0x5b03('0x4'));var rp=require(_0x5b03('0x5'));var fs=require('fs');var path=require(_0x5b03('0x6'));var rimraf=require(_0x5b03('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b03('0x8'));module[_0x5b03('0x9')]=function(_0x13eb7d,_0x3574e1){return _0x13eb7d[_0x5b03('0xa')](_0x5b03('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x5b03('0xc'),'fields':[_0x5b03('0xd')],'type':_0x5b03('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x847f58,_0x3a97b7,_0xd5919d){var _0xa3c52d=_0x13eb7d['models'];var _0x45c1a9=_0x847f58[_0x5b03('0xf')]({'plain':!![]});if(_0x45c1a9[_0x5b03('0x10')][_0x5b03('0x11')]()==='in'||_0x45c1a9[_0x5b03('0x10')][_0x5b03('0x11')]()===_0x5b03('0x12')&&!_0x45c1a9['secret']&&!_['isNil'](_0x45c1a9[_0x5b03('0x13')])){_0xa3c52d[_0x5b03('0x14')][_0x5b03('0x15')]({'where':{'id':_0x45c1a9[_0x5b03('0x16')]}})[_0x5b03('0x17')](function(_0x5ba971){if(_0x5ba971){_0x5ba971[_0x5b03('0x18')]({'lastMsgAt':_0x45c1a9[_0x5b03('0x19')],'lastMsgDirection':_0x45c1a9[_0x5b03('0x10')][_0x5b03('0x11')]()});}})[_0x5b03('0x1a')](function(_0x862704){console['error'](_0x862704);});}_0xd5919d();}},'charset':_0x5b03('0x1b'),'collate':_0x5b03('0x1c')});};