lrf 2 年之前
父節點
當前提交
d33d6198b5
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 3 2
      app/controller/business/config/.lesson.js
  2. 2 0
      app/model/business/lesson.js

+ 3 - 2
app/controller/business/config/.lesson.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['school_id', 'coach_id', 'class_hour', 'money', 'type'],
+    requestBody: ['title', 'school_id', 'coach_id', 'class_hour', 'money', 'type'],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['school_id', 'coach_id', 'class_hour', 'money', 'type'],
+    requestBody: ['title', 'school_id', 'coach_id', 'class_hour', 'money', 'type'],
   },
   show: {
     parameters: {
@@ -25,6 +25,7 @@ module.exports = {
         coach_id: 'coach_id',
         type: 'type',
         student: 'student',
+        title: 'title',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 2 - 0
app/model/business/lesson.js

@@ -6,6 +6,7 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 const lesson = {
   school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
   coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, //
+  title: { type: String, zh: '标题' },
   class_hour: { type: Number, required: false, zh: '课时' }, //
   money: { type: Number, required: false, zh: '金额' }, //
   student: { type: Array, ref: 'Student', getProp: [ 'name' ], zh: '学员' },
@@ -15,6 +16,7 @@ const schema = new Schema(lesson, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.index({ school_id: 1 });
+schema.index({ title: 1 });
 schema.index({ coach_id: 1 });
 schema.index({ type: 1 });