Built motion from commit 85328c08.|2.5.50
[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 _0x0260=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId'];(function(_0x3cdfdb,_0x40545d){var _0x57d4d8=function(_0x3e7f86){while(--_0x3e7f86){_0x3cdfdb['push'](_0x3cdfdb['shift']());}};_0x57d4d8(++_0x40545d);}(_0x0260,0x7f));var _0x0026=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0260[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x0026('0x0'));var util=require(_0x0026('0x1'));var logger=require(_0x0026('0x2'))(_0x0026('0x3'));var moment=require('moment');var BPromise=require(_0x0026('0x4'));var rp=require(_0x0026('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0026('0x6'));var config=require('../../config/environment');var attributes=require(_0x0026('0x7'));module['exports']=function(_0x365338,_0x141e20){return _0x365338[_0x0026('0x8')](_0x0026('0x9'),attributes,{'tableName':_0x0026('0xa'),'paranoid':![],'indexes':[{'name':_0x0026('0xb'),'fields':[_0x0026('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa26fae,_0x51f6cc,_0x321ac6){var _0x149e97=_0x365338[_0x0026('0xd')];var _0x2588f8=_0xa26fae[_0x0026('0xe')]({'plain':!![]});if(_0x2588f8['direction'][_0x0026('0xf')]()==='in'||_0x2588f8[_0x0026('0x10')][_0x0026('0xf')]()===_0x0026('0x11')&&!_0x2588f8[_0x0026('0x12')]&&!_[_0x0026('0x13')](_0x2588f8['UserId'])){_0x149e97[_0x0026('0x14')][_0x0026('0x15')]({'where':{'id':_0x2588f8[_0x0026('0x16')]}})[_0x0026('0x17')](function(_0xf05b07){if(_0xf05b07){_0xf05b07[_0x0026('0x18')]({'lastMsgAt':_0x2588f8[_0x0026('0x19')],'lastMsgDirection':_0x2588f8[_0x0026('0x10')]['toLowerCase']()});}})[_0x0026('0x1a')](function(_0x5ed932){console[_0x0026('0x1b')](_0x5ed932);});}_0x321ac6();}},'charset':_0x0026('0x1c'),'collate':_0x0026('0x1d')});};