online.js 581 B

12345678910111213141516171819
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 教师在线表
  5. const OnlineSchema = {
  6. teaid: { type: String, required: true, maxLength: 200 }, // 教师id
  7. status: { type: String, required: false, maxLength: 500 }, // 状态,0-下线,1-在线
  8. };
  9. const schema = new Schema(OnlineSchema, { toJSON: { virtuals: true } });
  10. schema.index({ id: 1 });
  11. schema.plugin(metaPlugin);
  12. module.exports = app => {
  13. const { mongoose } = app;
  14. return mongoose.model('Online', schema, 'online');
  15. };