report.js 695 B

1234567891011121314151617181920
  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 report = {
  8. disclosure_id: { type: ObjectId }, // 申请id
  9. content: { type: String }, // 内容
  10. remark: { type: String },
  11. };
  12. const schema = new Schema(report, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.index({ disclosure_id: 1 });
  15. schema.index({ 'meta.createdAt': 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('DisclosureReport', schema, 'disclosure_report');
  20. };