Built motion from commit (unavailable).|2.5.0
[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 _0x8c8b=['define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','catch','error','utf8mb4_unicode_ci','lodash','util','bluebird','path','../../config/environment'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x8c8b,0x1c3));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb8c8('0x0'));var util=require(_0xb8c8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb8c8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8c8('0x3'));var rimraf=require('rimraf');var config=require(_0xb8c8('0x4'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x48ec29,_0x510fff){return _0x48ec29[_0xb8c8('0x5')](_0xb8c8('0x6'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb8c8('0x7'),'fields':[_0xb8c8('0x8')],'type':_0xb8c8('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1877fe,_0x5bd6c1,_0x453a63){var _0x2dba88=_0x48ec29[_0xb8c8('0xa')];var _0x5d2a0f=_0x1877fe[_0xb8c8('0xb')]({'plain':!![]});if(_0x5d2a0f[_0xb8c8('0xc')][_0xb8c8('0xd')]()==='in'||_0x5d2a0f[_0xb8c8('0xc')]['toLowerCase']()===_0xb8c8('0xe')&&!_0x5d2a0f['secret']&&!_[_0xb8c8('0xf')](_0x5d2a0f[_0xb8c8('0x10')])){_0x2dba88[_0xb8c8('0x11')][_0xb8c8('0x12')]({'where':{'id':_0x5d2a0f[_0xb8c8('0x13')]}})[_0xb8c8('0x14')](function(_0x10953d){if(_0x10953d){_0x10953d['update']({'lastMsgAt':_0x5d2a0f['createdAt'],'lastMsgDirection':_0x5d2a0f['direction'][_0xb8c8('0xd')]()});}})[_0xb8c8('0x15')](function(_0x2dba48){console[_0xb8c8('0x16')](_0x2dba48);});}_0x453a63();}},'charset':'utf8mb4','collate':_0xb8c8('0x17')});};