guhongwei 4 лет назад
Родитель
Сommit
e6b96e994c
2 измененных файлов с 9 добавлено и 3 удалено
  1. 5 2
      app/controller/.testmess.js
  2. 4 1
      app/model/testmess.js

+ 5 - 2
app/controller/.testmess.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ["!title"],
+    requestBody: ["!title", "publish_time", "origin", "content"],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["!title"],
+    requestBody: ["!title", "publish_time", "origin", "content"],
   },
   show: {
     parameters: {
@@ -20,6 +20,9 @@ module.exports = {
     parameters: {
       query: {
         title: "title",
+        publish_time: "publish_time",
+        origin: "origin",
+        content: "content",
       },
     },
     service: "query",

+ 4 - 1
app/model/testmess.js

@@ -3,7 +3,10 @@ const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 // 测试信息
 const TestmessSchema = {
-  title: { type: String, required: true, maxLength: 200 }, // 标题
+  title: { type: String, required: false, maxLength: 200 }, // 标题
+  publish_time: { type: String, required: false, maxLength: 200 }, // 发布时间
+  origin: { type: String, required: false, maxLength: 200 }, // 来源
+  content: { type: String, required: false, maxLength: 200 }, // 内容
 };
 
 const schema = new Schema(TestmessSchema, { toJSON: { virtuals: true } });