Built motion from commit (unavailable).|2.5.7
[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 _0x2f7d=['ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x54904e,_0x5647ff){var _0x179c42=function(_0x318885){while(--_0x318885){_0x54904e['push'](_0x54904e['shift']());}};_0x179c42(++_0x5647ff);}(_0x2f7d,0x17d));var _0xd2f7=function(_0x19c641,_0x52dfca){_0x19c641=_0x19c641-0x0;var _0x5f2fd2=_0x2f7d[_0x19c641];return _0x5f2fd2;};'use strict';var _=require('lodash');var util=require(_0xd2f7('0x0'));var logger=require('../../config/logger')(_0xd2f7('0x1'));var moment=require(_0xd2f7('0x2'));var BPromise=require(_0xd2f7('0x3'));var rp=require(_0xd2f7('0x4'));var fs=require('fs');var path=require(_0xd2f7('0x5'));var rimraf=require(_0xd2f7('0x6'));var config=require(_0xd2f7('0x7'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x35c783,_0x39b9af){return _0x35c783[_0xd2f7('0x8')](_0xd2f7('0x9'),attributes,{'tableName':_0xd2f7('0xa'),'paranoid':![],'indexes':[{'name':_0xd2f7('0xb'),'fields':[_0xd2f7('0xc')],'type':_0xd2f7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d0403,_0x3a3a5a,_0x3ec8bb){var _0x1474dd=_0x35c783[_0xd2f7('0xe')];var _0x1f8096=_0x1d0403[_0xd2f7('0xf')]({'plain':!![]});if(_0x1f8096[_0xd2f7('0x10')]['toLowerCase']()==='in'||_0x1f8096[_0xd2f7('0x10')][_0xd2f7('0x11')]()===_0xd2f7('0x12')&&!_0x1f8096[_0xd2f7('0x13')]&&!_[_0xd2f7('0x14')](_0x1f8096[_0xd2f7('0x15')])){_0x1474dd['ChatInteraction'][_0xd2f7('0x16')]({'where':{'id':_0x1f8096[_0xd2f7('0x17')]}})[_0xd2f7('0x18')](function(_0x1ef22a){if(_0x1ef22a){_0x1ef22a[_0xd2f7('0x19')]({'lastMsgAt':_0x1f8096[_0xd2f7('0x1a')],'lastMsgDirection':_0x1f8096['direction']['toLowerCase']()});}})[_0xd2f7('0x1b')](function(_0x394f49){console['error'](_0x394f49);});}_0x3ec8bb();}},'charset':_0xd2f7('0x1c'),'collate':_0xd2f7('0x1d')});};