1234567891011121314151617181920 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const RoomChat = {
- number: { type: String, required: true, maxLength: 200 }, // 房间号
- sender_id: { type: String, required: true, maxLength: 200 }, // 发言人id
- sender_name: { type: String, required: true, maxLength: 200 }, // 发言人名称
- content: { type: String, required: true, maxLength: 1000 }, // 发言内容
- send_time: { type: String, required: true, maxLength: 100 }, // 发言时间:年月日时分秒
- role: { type: String, maxLength: 200 }, //用户身份
- };
- const schema = new Schema(RoomChat, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('RoomChat', schema, 'room_chat');
- };
|