Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / chatMessage / chatMessage.model.js
index c6c9d0d..d51cc18 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdbf5=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x2e1bab,_0x3e98bd){var _0xc8b2a8=function(_0x2b5854){while(--_0x2b5854){_0x2e1bab['push'](_0x2e1bab['shift']());}};_0xc8b2a8(++_0x3e98bd);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x189b5d,_0x4a4fa9){_0x189b5d=_0x189b5d-0x0;var _0x2b5c37=_0xdbf5[_0x189b5d];return _0x2b5c37;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x5dbf('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f9510,_0x3bec50,_0x264007){var _0x1813bb=_0x3f8628['models'];var _0xe3ddb7=_0x1f9510['get']({'plain':!![]});if(_0xe3ddb7['direction'][_0x5dbf('0xd')]()==='in'||_0xe3ddb7['direction']['toLowerCase']()===_0x5dbf('0xe')&&!_0xe3ddb7['secret']&&!_[_0x5dbf('0xf')](_0xe3ddb7[_0x5dbf('0x10')])){_0x1813bb[_0x5dbf('0x11')][_0x5dbf('0x12')]({'where':{'id':_0xe3ddb7[_0x5dbf('0x13')]}})['then'](function(_0x4803ca){if(_0x4803ca){_0x4803ca[_0x5dbf('0x14')]({'lastMsgAt':_0xe3ddb7[_0x5dbf('0x15')],'lastMsgDirection':_0xe3ddb7['direction'][_0x5dbf('0xd')]()});}})[_0x5dbf('0x16')](function(_0x23f763){console[_0x5dbf('0x17')](_0x23f763);});}_0x264007();}},'charset':_0x5dbf('0x18'),'collate':_0x5dbf('0x19')});};
\ 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