bd5278f4337bfc20fc8cfcd19046934e3c933ba7
[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 _0xf2d0=['toLowerCase','out','secret','isNil','FaxInteraction','FaxInteractionId','then','catch','error','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','direction'];(function(_0x81082e,_0xb1fae4){var _0x580e58=function(_0x1b57ab){while(--_0x1b57ab){_0x81082e['push'](_0x81082e['shift']());}};_0x580e58(++_0xb1fae4);}(_0xf2d0,0xa6));var _0x0f2d=function(_0x162d08,_0x317d6d){_0x162d08=_0x162d08-0x0;var _0x4532ea=_0xf2d0[_0x162d08];return _0x4532ea;};'use strict';var _=require(_0x0f2d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0f2d('0x1'));var moment=require(_0x0f2d('0x2'));var BPromise=require(_0x0f2d('0x3'));var rp=require(_0x0f2d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f2d('0x5'));var config=require(_0x0f2d('0x6'));var attributes=require(_0x0f2d('0x7'));module[_0x0f2d('0x8')]=function(_0x5a5dfc,_0x59f2ce){return _0x5a5dfc[_0x0f2d('0x9')](_0x0f2d('0xa'),attributes,{'tableName':_0x0f2d('0xb'),'paranoid':![],'indexes':[{'name':_0x0f2d('0xc'),'fields':[_0x0f2d('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dc78f,_0x4f8f55,_0x3df20a){var _0x197434=_0x5a5dfc[_0x0f2d('0xe')];var _0x2b9e11=_0x2dc78f['get']({'plain':!![]});if(_0x2b9e11[_0x0f2d('0xf')][_0x0f2d('0x10')]()==='in'||_0x2b9e11[_0x0f2d('0xf')][_0x0f2d('0x10')]()===_0x0f2d('0x11')&&!_0x2b9e11[_0x0f2d('0x12')]&&!_[_0x0f2d('0x13')](_0x2b9e11['UserId'])){_0x197434[_0x0f2d('0x14')]['findOne']({'where':{'id':_0x2b9e11[_0x0f2d('0x15')]}})[_0x0f2d('0x16')](function(_0x951f7e){if(_0x951f7e){_0x951f7e['update']({'lastMsgAt':_0x2b9e11['createdAt'],'lastMsgDirection':_0x2b9e11[_0x0f2d('0xf')]['toLowerCase']()});}})[_0x0f2d('0x17')](function(_0x475cd3){console[_0x0f2d('0x18')](_0x475cd3);});}_0x3df20a();}},'charset':'utf8mb4','collate':_0x0f2d('0x19')});};