lrf 2 tahun lalu
induk
melakukan
0620e5ccfe
2 mengubah file dengan 23 tambahan dan 2 penghapusan
  1. 19 2
      app/controller/config/.match.js
  2. 4 0
      app/model/race/match.js

+ 19 - 2
app/controller/config/.match.js

@@ -1,6 +1,21 @@
 module.exports = {
   create: {
-    requestBody: ['!logo', '!name', '!start_time', '!end_time', '!address', '!sign_time', 'money_remark', 'money_mode', '!contact', 'explain', 'regular', '!status'],
+    requestBody: [
+      'belong_id',
+      'type',
+      '!logo',
+      '!name',
+      '!start_time',
+      '!end_time',
+      '!address',
+      '!sign_time',
+      'money_remark',
+      'money_mode',
+      '!contact',
+      'explain',
+      'regular',
+      '!status',
+    ],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +23,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['logo', 'name', 'start_time', 'end_time', 'address', 'sign_time', 'money_remark', 'money_mode', 'contact', 'explain', 'regular', 'status'],
+    requestBody: ['belong_id', 'type', 'logo', 'name', 'start_time', 'end_time', 'address', 'sign_time', 'money_remark', 'money_mode', 'contact', 'explain', 'regular', 'status'],
   },
   show: {
     parameters: {
@@ -27,6 +42,8 @@ module.exports = {
         sign_time: 'sign_time',
         contact: 'contact',
         status: 'status',
+        belong_id: 'belong_id',
+        type: 'type',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 4 - 0
app/model/race/match.js

@@ -3,6 +3,8 @@ const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 // 比赛信息
 const match = {
+  belong_id: { type: String, zh: '属于id', ref: 'User', getProp: [ 'name' ] }, // 比赛系统中用户的数据id
+  type: { type: String, zh: '赛事类别' },
   logo: { type: Array, required: true, zh: '比赛logo' }, // 比赛logo
   name: { type: String, required: true, zh: '比赛名称' }, // 比赛名称
   start_time: { type: String, required: true, zh: '比赛开始时间' }, // 比赛开始时间
@@ -19,6 +21,8 @@ const match = {
 const schema = new Schema(match, { toJSON: { getters: true, virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ 'meta.createdAt': 1 });
+schema.index({ belong_id: 1 });
+schema.index({ type: 1 });
 schema.index({ name: 1 });
 schema.index({ start_time: 1 });
 schema.index({ end_time: 1 });