Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / api / chatMessage / chatMessage.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 _0x0bfe=['request-promise','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb65f15,_0xd554fd){var _0x3718be=function(_0x2bb4aa){while(--_0x2bb4aa){_0xb65f15['push'](_0xb65f15['shift']());}};_0x3718be(++_0xd554fd);}(_0x0bfe,0xbe));var _0xe0bf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0bfe[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe0bf('0x0'));var util=require(_0xe0bf('0x1'));var logger=require(_0xe0bf('0x2'))(_0xe0bf('0x3'));var moment=require(_0xe0bf('0x4'));var BPromise=require(_0xe0bf('0x5'));var rp=require(_0xe0bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0bf('0x7'));var config=require('../../config/environment');var attributes=require(_0xe0bf('0x8'));module[_0xe0bf('0x9')]=function(_0x11f68b,_0x3d00c5){return _0x11f68b[_0xe0bf('0xa')](_0xe0bf('0xb'),attributes,{'tableName':_0xe0bf('0xc'),'paranoid':![],'indexes':[{'name':_0xe0bf('0xd'),'fields':['body'],'type':_0xe0bf('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x392a35,_0x27e83e,_0x142e9b){var _0x22d7e7=_0x11f68b[_0xe0bf('0xf')];var _0xfc39d8=_0x392a35[_0xe0bf('0x10')]({'plain':!![]});if(_0xfc39d8[_0xe0bf('0x11')][_0xe0bf('0x12')]()==='in'||_0xfc39d8['direction'][_0xe0bf('0x12')]()===_0xe0bf('0x13')&&!_0xfc39d8[_0xe0bf('0x14')]&&!_['isNil'](_0xfc39d8['UserId'])){_0x22d7e7['ChatInteraction'][_0xe0bf('0x15')]({'where':{'id':_0xfc39d8[_0xe0bf('0x16')]}})['then'](function(_0x50ac2a){if(_0x50ac2a){_0x50ac2a[_0xe0bf('0x17')]({'lastMsgAt':_0xfc39d8[_0xe0bf('0x18')],'lastMsgDirection':_0xfc39d8[_0xe0bf('0x11')]['toLowerCase']()});}})[_0xe0bf('0x19')](function(_0x56f5a5){console['error'](_0x56f5a5);});}_0x142e9b();}},'charset':_0xe0bf('0x1a'),'collate':_0xe0bf('0x1b')});};