Built motion from commit (unavailable).|2.5.26
[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 _0x81cc=['secret','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x81cc,0xaa));var _0xc81c=function(_0x2e7007,_0x41ffa9){_0x2e7007=_0x2e7007-0x0;var _0x2d353a=_0x81cc[_0x2e7007];return _0x2d353a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc81c('0x0'));var moment=require(_0xc81c('0x1'));var BPromise=require(_0xc81c('0x2'));var rp=require(_0xc81c('0x3'));var fs=require('fs');var path=require(_0xc81c('0x4'));var rimraf=require('rimraf');var config=require(_0xc81c('0x5'));var attributes=require(_0xc81c('0x6'));module[_0xc81c('0x7')]=function(_0x1a4cbf,_0x4556e8){return _0x1a4cbf[_0xc81c('0x8')](_0xc81c('0x9'),attributes,{'tableName':_0xc81c('0xa'),'paranoid':![],'indexes':[{'name':_0xc81c('0xb'),'fields':[_0xc81c('0xc')],'type':_0xc81c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x558b24,_0x2fc817,_0x26a172){var _0x29cfc5=_0x1a4cbf[_0xc81c('0xe')];var _0x444318=_0x558b24[_0xc81c('0xf')]({'plain':!![]});if(_0x444318['direction']['toLowerCase']()==='in'||_0x444318[_0xc81c('0x10')][_0xc81c('0x11')]()===_0xc81c('0x12')&&!_0x444318[_0xc81c('0x13')]&&!_['isNil'](_0x444318[_0xc81c('0x14')])){_0x29cfc5[_0xc81c('0x15')]['findOne']({'where':{'id':_0x444318[_0xc81c('0x16')]}})[_0xc81c('0x17')](function(_0x536ae6){if(_0x536ae6){_0x536ae6[_0xc81c('0x18')]({'lastMsgAt':_0x444318[_0xc81c('0x19')],'lastMsgDirection':_0x444318[_0xc81c('0x10')][_0xc81c('0x11')]()});}})[_0xc81c('0x1a')](function(_0x4caf54){console['error'](_0x4caf54);});}_0x26a172();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};