12345678910111213141516171819202122232425 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 学校表
- const SchoolSchema = {
- code: { type: String, required: false, maxLength: 200 }, // 学校代码
- name: { type: String, required: false, maxLength: 500 }, // 学校名称
- shortname: { type: String, required: false, maxLength: 500 }, // 学校简称
- logourl: { type: String, required: false, maxLength: 500 }, // logo路径
- level: { type: String, required: false, maxLength: 500 }, // 高校层次
- address: { type: String, required: false, maxLength: 500 }, // 高校地址
- number: { type: String, required: false, maxLength: 500 }, // 人数
- hascar: { type: String, required: false, maxLength: 500 }, // 是否派车,0-否,1-是
- };
- const schema = new Schema(SchoolSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('School', schema, 'school');
- };
|