|
@@ -0,0 +1,21 @@
|
|
|
+'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 }, // 学校名称
|
|
|
+ logourl: { type: String, required: false, maxLength: 500 }, // logo路径
|
|
|
+ level: { type: String, required: false, maxLength: 500 }, // 高校层次
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+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');
|
|
|
+};
|