8e0b7a70e38edddca879464c123bc480bf6e5838
[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 _0x8f3e=['util','bluebird','request-promise','rimraf','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','toLowerCase','direction','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x227cb9,_0x205b26){var _0x2fad12=function(_0x1c4c40){while(--_0x1c4c40){_0x227cb9['push'](_0x227cb9['shift']());}};_0x2fad12(++_0x205b26);}(_0x8f3e,0x108));var _0xe8f3=function(_0x108698,_0x565042){_0x108698=_0x108698-0x0;var _0x226c68=_0x8f3e[_0x108698];return _0x226c68;};'use strict';var _=require('lodash');var util=require(_0xe8f3('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe8f3('0x1'));var rp=require(_0xe8f3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8f3('0x3'));var config=require(_0xe8f3('0x4'));var attributes=require('./faxMessage.attributes');module[_0xe8f3('0x5')]=function(_0x2386c0,_0x26df48){return _0x2386c0['define'](_0xe8f3('0x6'),attributes,{'tableName':_0xe8f3('0x7'),'paranoid':![],'indexes':[{'name':_0xe8f3('0x8'),'fields':[_0xe8f3('0x9')],'type':_0xe8f3('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40ad38,_0x61e613,_0x1076f0){var _0x2e6c9c=_0x2386c0['models'];var _0x591fd3=_0x40ad38['get']({'plain':!![]});if(_0x591fd3['direction'][_0xe8f3('0xb')]()==='in'||_0x591fd3[_0xe8f3('0xc')]['toLowerCase']()==='out'&&!_0x591fd3['secret']&&!_['isNil'](_0x591fd3[_0xe8f3('0xd')])){_0x2e6c9c[_0xe8f3('0xe')][_0xe8f3('0xf')]({'where':{'id':_0x591fd3[_0xe8f3('0x10')]}})[_0xe8f3('0x11')](function(_0x5c2767){if(_0x5c2767){_0x5c2767[_0xe8f3('0x12')]({'lastMsgAt':_0x591fd3[_0xe8f3('0x13')],'lastMsgDirection':_0x591fd3['direction'][_0xe8f3('0xb')]()});}})[_0xe8f3('0x14')](function(_0x8cb927){console[_0xe8f3('0x15')](_0x8cb927);});}_0x1076f0();}},'charset':_0xe8f3('0x16'),'collate':_0xe8f3('0x17')});};