answerchat.js 1.0 KB

12345678910111213141516171819202122
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const Answerchat = {
  5. sender_id: { type: String, required: true, maxLength: 200 }, // 发言人id
  6. sender_name: { type: String, required: true, maxLength: 200 }, // 发言人名称
  7. receiver_id: { type: String, required: true, maxLength: 200 }, // 接收人id
  8. receiver_name: { type: String, required: true, maxLength: 200 }, // 接收人名字
  9. room: { type: String, required: true, maxLength: 200 }, // 房间号
  10. content: { type: String, required: true }, // 发言内容
  11. send_time: { type: String, required: true, maxLength: 100 }, // 发言时间:年月日时分秒
  12. status: { type: String, maxLength: 200, default: '0' }, // 状态:0=>未读;1=>已读
  13. };
  14. const schema = new Schema(Answerchat, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Answerchat', schema, 'answerchat');
  20. };