school.js 955 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 学校表
  5. const SchoolSchema = {
  6. code: { type: String, required: false, maxLength: 200 }, // 学校代码
  7. name: { type: String, required: false, maxLength: 500 }, // 学校名称
  8. logourl: { type: String, required: false, maxLength: 500 }, // logo路径
  9. level: { type: String, required: false, maxLength: 500 }, // 高校层次
  10. address: { type: String, required: false, maxLength: 500 }, // 高校地址
  11. number: { type: String, required: false, maxLength: 500 }, // 人数
  12. hascar: { type: String, required: false, maxLength: 500 }, // 是否派车,0-否,1-是
  13. };
  14. const schema = new Schema(SchoolSchema, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('School', schema, 'school');
  20. };