liuyu 4 years ago
parent
commit
61dcc0ef14
2 changed files with 7 additions and 5 deletions
  1. 3 2
      app/controller/.chat.js
  2. 4 3
      app/model/chat.js

+ 3 - 2
app/controller/.chat.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ["roomid", "!type", "!content", "!sendid"],
+    requestBody: ["roomid", "type", "!content", "!sendid","sendname"],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["roomid", "type", "content", "sendid"],
+    requestBody: ["roomid", "type", "content", "sendid","sendname"],
   },
   show: {
     parameters: {
@@ -23,6 +23,7 @@ module.exports = {
         type: "type",
         content: "content",
         sendid: "sendid",
+        sendid: "sendname",
       },
     },
     service: "query",

+ 4 - 3
app/model/chat.js

@@ -4,9 +4,10 @@ const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 
 const ChatSchema = {
   roomid: { type: String, required: false, maxLength: 200 }, // 房间名称
-  type: { type: String, required: true, maxLength: 64 }, // 类型0、直播1、会议
-  content: { type: String, required: true, maxLength: 200 }, // 封面图片
-  sendid: { type: String, required: true, maxLength: 200 }, // 发送人id
+  type: { type: String, required: false, maxLength: 64 }, // 类型0、直播1、会议
+  content: { type: String, required: false, maxLength: 200 }, // 封面图片
+  sendid: { type: String, required: false, maxLength: 200 }, // 发送人id
+  sendname: { type: String, required: false, maxLength: 200 }, // 发送人
 };
 
 const schema = new Schema(ChatSchema, { toJSON: { virtuals: true } });