dockChat.js 915 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. const Schema = require("mongoose").Schema;
  3. const moment = require("moment");
  4. const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
  5. const { ObjectId } = require("mongoose").Types;
  6. // 展会公共聊天表
  7. const dock_chat = {
  8. dock_id: { type: String }, // 展会id
  9. sender_id: { type: String }, // 发送人id
  10. sender_name: { type: String }, // 发送人姓名
  11. content: { type: String }, // 发送内容
  12. send_time: { type: String }, //发送时间
  13. remark: { type: String, maxLength: 200 },
  14. };
  15. const schema = new Schema(dock_chat, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.index({ dock_id: 1 });
  18. schema.index({ sender_id: 1 });
  19. schema.index({ sender_name: 1 });
  20. schema.index({ "meta.createdAt": 1 });
  21. schema.plugin(metaPlugin);
  22. module.exports = (app) => {
  23. const { mongoose } = app;
  24. return mongoose.model("DockChat", schema, "dockChat");
  25. };