Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / chatMessage / chatMessage.model.js
index 0d1aa7f..d51cc18 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0504=['ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','ChatInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0504,0x147));var _0x4050=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x0504[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0x4050('0x0'));var logger=require(_0x4050('0x1'))(_0x4050('0x2'));var moment=require(_0x4050('0x3'));var BPromise=require(_0x4050('0x4'));var rp=require(_0x4050('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4050('0x6'));var config=require(_0x4050('0x7'));var attributes=require('./chatMessage.attributes');module[_0x4050('0x8')]=function(_0x26da81,_0x2fd317){return _0x26da81['define'](_0x4050('0x9'),attributes,{'tableName':_0x4050('0xa'),'paranoid':![],'indexes':[{'name':_0x4050('0xb'),'fields':[_0x4050('0xc')],'type':_0x4050('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51a7ba,_0x1a9b86,_0x78777){var _0x1f5f78=_0x26da81[_0x4050('0xe')];var _0x1bcf7e=_0x51a7ba[_0x4050('0xf')]({'plain':!![]});if(_0x1bcf7e['direction']['toLowerCase']()==='in'||_0x1bcf7e[_0x4050('0x10')][_0x4050('0x11')]()===_0x4050('0x12')&&!_0x1bcf7e[_0x4050('0x13')]&&!_[_0x4050('0x14')](_0x1bcf7e['UserId'])){_0x1f5f78[_0x4050('0x15')]['findOne']({'where':{'id':_0x1bcf7e[_0x4050('0x16')]}})[_0x4050('0x17')](function(_0x374a23){if(_0x374a23){_0x374a23[_0x4050('0x18')]({'lastMsgAt':_0x1bcf7e['createdAt'],'lastMsgDirection':_0x1bcf7e[_0x4050('0x10')][_0x4050('0x11')]()});}})[_0x4050('0x19')](function(_0x1c689b){console['error'](_0x1c689b);});}_0x78777();}},'charset':_0x4050('0x1a'),'collate':_0x4050('0x1b')});};
\ No newline at end of file
+var _0x300f=['models','direction','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','fti_chat_messages','body','FULLTEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x300f,0x18e));var _0xf300=function(_0x1baf54,_0x2ce8fb){_0x1baf54=_0x1baf54-0x0;var _0x58bb2f=_0x300f[_0x1baf54];return _0x58bb2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf300('0x0'))(_0xf300('0x1'));var moment=require(_0xf300('0x2'));var BPromise=require(_0xf300('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf300('0x4'));var attributes=require('./chatMessage.attributes');module[_0xf300('0x5')]=function(_0x5c641e,_0x1a7f70){return _0x5c641e[_0xf300('0x6')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xf300('0x7'),'fields':[_0xf300('0x8')],'type':_0xf300('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d3ab0,_0x266483,_0x1e52ae){var _0x9d3d7e=_0x5c641e[_0xf300('0xa')];var _0x763ec=_0x2d3ab0['get']({'plain':!![]});if(_0x763ec[_0xf300('0xb')]['toLowerCase']()==='in'||_0x763ec['direction']['toLowerCase']()===_0xf300('0xc')&&!_0x763ec[_0xf300('0xd')]&&!_[_0xf300('0xe')](_0x763ec[_0xf300('0xf')])){_0x9d3d7e[_0xf300('0x10')][_0xf300('0x11')]({'where':{'id':_0x763ec['ChatInteractionId']}})[_0xf300('0x12')](function(_0x416c8c){if(_0x416c8c){_0x416c8c[_0xf300('0x13')]({'lastMsgAt':_0x763ec['createdAt'],'lastMsgDirection':_0x763ec[_0xf300('0xb')][_0xf300('0x14')]()});}})[_0xf300('0x15')](function(_0x5dc3e7){console['error'](_0x5dc3e7);});}_0x1e52ae();}},'charset':_0xf300('0x16'),'collate':_0xf300('0x17')});};
\ No newline at end of file