Built motion from commit (unavailable).|2.4.17
[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 _0x8f87=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x8f87,0x167));var _0x78f8=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x8f87[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require(_0x78f8('0x0'));var util=require(_0x78f8('0x1'));var logger=require(_0x78f8('0x2'))(_0x78f8('0x3'));var moment=require(_0x78f8('0x4'));var BPromise=require(_0x78f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78f8('0x6'));var rimraf=require('rimraf');var config=require(_0x78f8('0x7'));var attributes=require(_0x78f8('0x8'));module[_0x78f8('0x9')]=function(_0x304aee,_0x1d46a2){return _0x304aee['define'](_0x78f8('0xa'),attributes,{'tableName':_0x78f8('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x78f8('0xc')],'type':_0x78f8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x585363,_0x16c31d,_0x34b89f){var _0x21c25e=_0x304aee[_0x78f8('0xe')];var _0x4261de=_0x585363[_0x78f8('0xf')]({'plain':!![]});if(_0x4261de[_0x78f8('0x10')]['toLowerCase']()==='in'||_0x4261de[_0x78f8('0x10')][_0x78f8('0x11')]()===_0x78f8('0x12')&&!_0x4261de[_0x78f8('0x13')]&&!_[_0x78f8('0x14')](_0x4261de[_0x78f8('0x15')])){_0x21c25e[_0x78f8('0x16')][_0x78f8('0x17')]({'where':{'id':_0x4261de[_0x78f8('0x18')]}})[_0x78f8('0x19')](function(_0x5ed736){if(_0x5ed736){_0x5ed736[_0x78f8('0x1a')]({'lastMsgAt':_0x4261de[_0x78f8('0x1b')],'lastMsgDirection':_0x4261de['direction'][_0x78f8('0x11')]()});}})[_0x78f8('0x1c')](function(_0x309574){console[_0x78f8('0x1d')](_0x309574);});}_0x34b89f();}},'charset':_0x78f8('0x1e'),'collate':_0x78f8('0x1f')});};