school.js 1.0 KB

12345678910111213141516171819202122232425
  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. shortname: { type: String, required: false, maxLength: 500 }, // 学校简称
  9. logourl: { type: String, required: false, maxLength: 500 }, // logo路径
  10. level: { type: String, required: false, maxLength: 500 }, // 高校层次
  11. address: { type: String, required: false, maxLength: 500 }, // 高校地址
  12. number: { type: String, required: false, maxLength: 500 }, // 人数
  13. hascar: { type: String, required: false, maxLength: 500 }, // 是否派车,0-否,1-是
  14. };
  15. const schema = new Schema(SchoolSchema, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('School', schema, 'school');
  21. };