Built motion from commit (unavailable).|2.5.29
[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 _0xf95f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','findOne','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util'];(function(_0x534002,_0x59bf94){var _0x12913e=function(_0x2ec17e){while(--_0x2ec17e){_0x534002['push'](_0x534002['shift']());}};_0x12913e(++_0x59bf94);}(_0xf95f,0x142));var _0xff95=function(_0x300d13,_0x412659){_0x300d13=_0x300d13-0x0;var _0x39541d=_0xf95f[_0x300d13];return _0x39541d;};'use strict';var _=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var logger=require(_0xff95('0x2'))(_0xff95('0x3'));var moment=require(_0xff95('0x4'));var BPromise=require(_0xff95('0x5'));var rp=require(_0xff95('0x6'));var fs=require('fs');var path=require(_0xff95('0x7'));var rimraf=require(_0xff95('0x8'));var config=require('../../config/environment');var attributes=require(_0xff95('0x9'));module['exports']=function(_0x3f72b4,_0x4fb1ed){return _0x3f72b4[_0xff95('0xa')](_0xff95('0xb'),attributes,{'tableName':_0xff95('0xc'),'paranoid':![],'indexes':[{'name':_0xff95('0xd'),'fields':[_0xff95('0xe')],'type':_0xff95('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf5af08,_0xa2a50d,_0x522870){var _0x50293a=_0x3f72b4[_0xff95('0x10')];var _0x4547b5=_0xf5af08[_0xff95('0x11')]({'plain':!![]});if(_0x4547b5[_0xff95('0x12')][_0xff95('0x13')]()==='in'||_0x4547b5[_0xff95('0x12')][_0xff95('0x13')]()==='out'&&!_0x4547b5['secret']&&!_[_0xff95('0x14')](_0x4547b5[_0xff95('0x15')])){_0x50293a['ChatInteraction'][_0xff95('0x16')]({'where':{'id':_0x4547b5['ChatInteractionId']}})['then'](function(_0x5d8005){if(_0x5d8005){_0x5d8005[_0xff95('0x17')]({'lastMsgAt':_0x4547b5[_0xff95('0x18')],'lastMsgDirection':_0x4547b5[_0xff95('0x12')][_0xff95('0x13')]()});}})[_0xff95('0x19')](function(_0x399d87){console['error'](_0x399d87);});}_0x522870();}},'charset':'utf8mb4','collate':_0xff95('0x1a')});};