1234567891011121314151617181920 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 聊天房间表
- const RoomSchema = {
- teaid: { type: String, required: true, maxLength: 200 }, // 教师id
- stuid: { type: String, required: true, maxLength: 200 }, // 学生id
- status: { type: String, required: false, maxLength: 500 }, // 状态,0-开始,1-结束
- };
- const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Room', schema, 'room');
- };
|