Built motion from commit (unavailable).|2.5.25
[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 _0xd8c7=['catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','FaxInteraction','findOne','FaxInteractionId','update','createdAt'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd8c7,0x73));var _0x7d8c=function(_0x436350,_0x5cc57c){_0x436350=_0x436350-0x0;var _0x318387=_0xd8c7[_0x436350];return _0x318387;};'use strict';var _=require(_0x7d8c('0x0'));var util=require(_0x7d8c('0x1'));var logger=require(_0x7d8c('0x2'))(_0x7d8c('0x3'));var moment=require(_0x7d8c('0x4'));var BPromise=require(_0x7d8c('0x5'));var rp=require(_0x7d8c('0x6'));var fs=require('fs');var path=require(_0x7d8c('0x7'));var rimraf=require(_0x7d8c('0x8'));var config=require(_0x7d8c('0x9'));var attributes=require('./faxMessage.attributes');module[_0x7d8c('0xa')]=function(_0x7f99f1,_0x137305){return _0x7f99f1['define'](_0x7d8c('0xb'),attributes,{'tableName':_0x7d8c('0xc'),'paranoid':![],'indexes':[{'name':_0x7d8c('0xd'),'fields':['body'],'type':_0x7d8c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4139d0,_0x2aa8dc,_0x58ef31){var _0x340e40=_0x7f99f1[_0x7d8c('0xf')];var _0x291b10=_0x4139d0[_0x7d8c('0x10')]({'plain':!![]});if(_0x291b10[_0x7d8c('0x11')]['toLowerCase']()==='in'||_0x291b10[_0x7d8c('0x11')][_0x7d8c('0x12')]()==='out'&&!_0x291b10[_0x7d8c('0x13')]&&!_['isNil'](_0x291b10['UserId'])){_0x340e40[_0x7d8c('0x14')][_0x7d8c('0x15')]({'where':{'id':_0x291b10[_0x7d8c('0x16')]}})['then'](function(_0x541514){if(_0x541514){_0x541514[_0x7d8c('0x17')]({'lastMsgAt':_0x291b10[_0x7d8c('0x18')],'lastMsgDirection':_0x291b10[_0x7d8c('0x11')]['toLowerCase']()});}})[_0x7d8c('0x19')](function(_0xbd727e){console[_0x7d8c('0x1a')](_0xbd727e);});}_0x58ef31();}},'charset':_0x7d8c('0x1b'),'collate':'utf8mb4_unicode_ci'});};