Built motion from commit (unavailable).|2.5.2
[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 _0x2c6d=['request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x468cc5,_0x399e95){var _0x25f62e=function(_0x2a1e84){while(--_0x2a1e84){_0x468cc5['push'](_0x468cc5['shift']());}};_0x25f62e(++_0x399e95);}(_0x2c6d,0x1cb));var _0xd2c6=function(_0x4a0e7b,_0x543312){_0x4a0e7b=_0x4a0e7b-0x0;var _0x13e26c=_0x2c6d[_0x4a0e7b];return _0x13e26c;};'use strict';var _=require(_0xd2c6('0x0'));var util=require('util');var logger=require(_0xd2c6('0x1'))(_0xd2c6('0x2'));var moment=require(_0xd2c6('0x3'));var BPromise=require(_0xd2c6('0x4'));var rp=require(_0xd2c6('0x5'));var fs=require('fs');var path=require(_0xd2c6('0x6'));var rimraf=require(_0xd2c6('0x7'));var config=require(_0xd2c6('0x8'));var attributes=require('./faxMessage.attributes');module[_0xd2c6('0x9')]=function(_0x5c5676,_0x19e297){return _0x5c5676[_0xd2c6('0xa')](_0xd2c6('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xd2c6('0xc'),'fields':['body'],'type':_0xd2c6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1106c0,_0x5ba1e7,_0x426e21){var _0x111421=_0x5c5676[_0xd2c6('0xe')];var _0x4b4ed4=_0x1106c0[_0xd2c6('0xf')]({'plain':!![]});if(_0x4b4ed4[_0xd2c6('0x10')][_0xd2c6('0x11')]()==='in'||_0x4b4ed4['direction']['toLowerCase']()===_0xd2c6('0x12')&&!_0x4b4ed4['secret']&&!_['isNil'](_0x4b4ed4[_0xd2c6('0x13')])){_0x111421['FaxInteraction'][_0xd2c6('0x14')]({'where':{'id':_0x4b4ed4[_0xd2c6('0x15')]}})[_0xd2c6('0x16')](function(_0xa2c380){if(_0xa2c380){_0xa2c380[_0xd2c6('0x17')]({'lastMsgAt':_0x4b4ed4[_0xd2c6('0x18')],'lastMsgDirection':_0x4b4ed4[_0xd2c6('0x10')][_0xd2c6('0x11')]()});}})[_0xd2c6('0x19')](function(_0x49ddee){console[_0xd2c6('0x1a')](_0x49ddee);});}_0x426e21();}},'charset':_0xd2c6('0x1b'),'collate':_0xd2c6('0x1c')});};