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