12345678910111213141516171819202122 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 教师-学生答疑房间
- const ChatroommSchema = {
- number: { type: String, required: false, maxLength: 200, default: new Date().getTime() }, // 房间号
- teacherid: { type: String, required: true, maxLength: 200 }, // 教师id
- teacher: { type: String, required: true, maxLength: 200 }, // 教师
- studentid: { type: String, required: true, maxLength: 200 }, // 学生id
- student: { type: String, required: true, maxLength: 200 }, // 学生
- };
- const schema = new Schema(ChatroommSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Chatroom', schema, 'chatroom');
- };
|