Built motion from commit 9d1906d1.|2.5.40
[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 _0xf889=['../../config/environment','./faxMessage.attributes','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0xf889,0x1e6));var _0x9f88=function(_0xed17d8,_0x472e47){_0xed17d8=_0xed17d8-0x0;var _0x46979e=_0xf889[_0xed17d8];return _0x46979e;};'use strict';var _=require('lodash');var util=require(_0x9f88('0x0'));var logger=require(_0x9f88('0x1'))(_0x9f88('0x2'));var moment=require(_0x9f88('0x3'));var BPromise=require(_0x9f88('0x4'));var rp=require(_0x9f88('0x5'));var fs=require('fs');var path=require(_0x9f88('0x6'));var rimraf=require(_0x9f88('0x7'));var config=require(_0x9f88('0x8'));var attributes=require(_0x9f88('0x9'));module['exports']=function(_0xcd7e93,_0x39ebdd){return _0xcd7e93['define'](_0x9f88('0xa'),attributes,{'tableName':_0x9f88('0xb'),'paranoid':![],'indexes':[{'name':_0x9f88('0xc'),'fields':[_0x9f88('0xd')],'type':_0x9f88('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41aeab,_0x252c7a,_0x141164){var _0x547755=_0xcd7e93['models'];var _0x195dca=_0x41aeab['get']({'plain':!![]});if(_0x195dca[_0x9f88('0xf')][_0x9f88('0x10')]()==='in'||_0x195dca[_0x9f88('0xf')][_0x9f88('0x10')]()===_0x9f88('0x11')&&!_0x195dca['secret']&&!_['isNil'](_0x195dca[_0x9f88('0x12')])){_0x547755[_0x9f88('0x13')][_0x9f88('0x14')]({'where':{'id':_0x195dca[_0x9f88('0x15')]}})['then'](function(_0x1d9920){if(_0x1d9920){_0x1d9920[_0x9f88('0x16')]({'lastMsgAt':_0x195dca[_0x9f88('0x17')],'lastMsgDirection':_0x195dca[_0x9f88('0xf')][_0x9f88('0x10')]()});}})['catch'](function(_0x271ee9){console[_0x9f88('0x18')](_0x271ee9);});}_0x141164();}},'charset':_0x9f88('0x19'),'collate':'utf8mb4_unicode_ci'});};