1234567891011121314151617181920 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 科目表
- const SubjectSchema = {
- code: { type: String, required: false, maxLength: 200 }, // 科目代码
- name: { type: String, required: false, maxLength: 500 }, // 科目名称
- type: { type: String, required: false, maxLength: 500 }, // 类型,0-普通班,1-特殊班
- };
- const schema = new Schema(SubjectSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Subject', schema, 'subject');
- };
|