kjzl_chat.js 983 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 科教之旅-评价表
  7. const kjzl_chat = {
  8. medium_id: { type: ObjectId }, // 机构id
  9. openid: { type: String }, // 用户id
  10. project: { type: Object }, // 服务项目
  11. orderid: { type: String }, // 订单id
  12. create_time: { type: String }, // 时间
  13. content: { type: String }, // 评价内容
  14. remark: { type: String },
  15. };
  16. const schema = new Schema(kjzl_chat, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.index({ medium_id: 1 });
  19. schema.index({ openid: 1 });
  20. schema.index({ project: 1 });
  21. schema.index({ orderid: 1 });
  22. schema.index({ create_time: 1 });
  23. schema.index({ 'meta.createdAt': 1 });
  24. schema.plugin(metaPlugin);
  25. module.exports = app => {
  26. const { mongoose } = app;
  27. return mongoose.model('Kjzl_chat', schema, 'kjzl_chat');
  28. };