Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / chatMessage / chatMessage.model.js
1 const a82_0x4713=['isNil','./chatMessage.attributes','direction','update','toLowerCase','findOne','then','ChatInteractionId','FULLTEXT','models','ChatInteraction','exports','get','utf8mb4','chat_messages','out','utf8mb4_unicode_ci'];(function(_0x4fbac6,_0x4713ef){const _0x11f997=function(_0x5cf484){while(--_0x5cf484){_0x4fbac6['push'](_0x4fbac6['shift']());}};_0x11f997(++_0x4713ef);}(a82_0x4713,0xf3));const a82_0x11f9=function(_0x4fbac6,_0x4713ef){_0x4fbac6=_0x4fbac6-0x0;let _0x11f997=a82_0x4713[_0x4fbac6];return _0x11f997;};const _0x405432=a82_0x11f9;'use strict';const _=require('lodash'),attributes=require(_0x405432('0xd'));module[_0x405432('0x6')]=function(_0x5cf484){const _0xf3b1c2=_0x405432,_0x5b83a3=_0x5cf484[_0xf3b1c2('0x4')],_0x321b7a=_0x5cf484['define']('ChatMessage',attributes,{'tableName':_0xf3b1c2('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xf3b1c2('0x3')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b4005){const _0x157de6=_0xf3b1c2,_0x48b7aa=_0x2b4005[_0x157de6('0x7')]({'plain':!![]});(_0x48b7aa[_0x157de6('0xe')][_0x157de6('0x10')]()==='in'||_0x48b7aa[_0x157de6('0xe')][_0x157de6('0x10')]()===_0x157de6('0xa')&&!_0x48b7aa['secret']&&!_[_0x157de6('0xc')](_0x48b7aa['UserId']))&&_0x5b83a3[_0x157de6('0x5')][_0x157de6('0x0')]({'where':{'id':_0x48b7aa[_0x157de6('0x2')]}})[_0x157de6('0x1')](function(_0x2cc4a0){const _0x22b9ff=_0x157de6;_0x2cc4a0&&_0x2cc4a0[_0x22b9ff('0xf')]({'lastMsgAt':_0x48b7aa['createdAt'],'lastMsgDirection':_0x48b7aa[_0x22b9ff('0xe')]['toLowerCase']()});})['catch'](function(_0x2410c9){console['error'](_0x2410c9);});}},'charset':_0xf3b1c2('0x8'),'collate':_0xf3b1c2('0xb')});return _0x321b7a;};