Built motion from commit (unavailable).|2.5.16
[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 _0x99f5=['out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','toLowerCase','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','models','get','direction'];(function(_0x50cb11,_0x2a69c2){var _0x241ddc=function(_0x5486ef){while(--_0x5486ef){_0x50cb11['push'](_0x50cb11['shift']());}};_0x241ddc(++_0x2a69c2);}(_0x99f5,0x1cc));var _0x599f=function(_0x4f87cf,_0x4aaa72){_0x4f87cf=_0x4f87cf-0x0;var _0x218f1e=_0x99f5[_0x4f87cf];return _0x218f1e;};'use strict';var _=require(_0x599f('0x0'));var util=require(_0x599f('0x1'));var logger=require(_0x599f('0x2'))(_0x599f('0x3'));var moment=require(_0x599f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x599f('0x5'));var rimraf=require(_0x599f('0x6'));var config=require('../../config/environment');var attributes=require(_0x599f('0x7'));module[_0x599f('0x8')]=function(_0x3f4c95,_0x1026d6){return _0x3f4c95[_0x599f('0x9')](_0x599f('0xa'),attributes,{'tableName':_0x599f('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x599f('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47d98c,_0x35f6b8,_0x288a7a){var _0x1d8422=_0x3f4c95[_0x599f('0xd')];var _0x634222=_0x47d98c[_0x599f('0xe')]({'plain':!![]});if(_0x634222['direction']['toLowerCase']()==='in'||_0x634222[_0x599f('0xf')]['toLowerCase']()===_0x599f('0x10')&&!_0x634222['secret']&&!_[_0x599f('0x11')](_0x634222[_0x599f('0x12')])){_0x1d8422[_0x599f('0x13')][_0x599f('0x14')]({'where':{'id':_0x634222[_0x599f('0x15')]}})[_0x599f('0x16')](function(_0x553535){if(_0x553535){_0x553535[_0x599f('0x17')]({'lastMsgAt':_0x634222[_0x599f('0x18')],'lastMsgDirection':_0x634222[_0x599f('0xf')][_0x599f('0x19')]()});}})[_0x599f('0x1a')](function(_0x4e6c9f){console['error'](_0x4e6c9f);});}_0x288a7a();}},'charset':'utf8mb4','collate':_0x599f('0x1b')});};