12345678910111213141516171819202122232425 |
- "use strict";
- const Schema = require("mongoose").Schema;
- const moment = require("moment");
- const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
- const { ObjectId } = require("mongoose").Types;
- // 展会公共聊天表
- const dock_chat = {
- dock_id: { type: String }, // 展会id
- sender_id: { type: String }, // 发送人id
- sender_name: { type: String }, // 发送人姓名
- content: { type: String }, // 发送内容
- send_time: { type: String }, //发送时间
- remark: { type: String, maxLength: 200 },
- };
- const schema = new Schema(dock_chat, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ dock_id: 1 });
- schema.index({ sender_id: 1 });
- schema.index({ sender_name: 1 });
- schema.index({ "meta.createdAt": 1 });
- schema.plugin(metaPlugin);
- module.exports = (app) => {
- const { mongoose } = app;
- return mongoose.model("DockChat", schema, "dockChat");
- };
|