ticket_record.js 904 B

123456789101112131415161718192021222324
  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 ticket_record = {
  8. ticket_id: { type: ObjectId },
  9. opera_id: { type: ObjectId }, // 审核人
  10. status: { type: String }, // 改变为的状态
  11. desc: { type: String }, // 建议
  12. remark: { type: String },
  13. create_time: { type: String, default: moment(new Date()).format('YYYY-MM-DD HH:mm:ss') },
  14. };
  15. const schema = new Schema(ticket_record, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.index({ ticket_id: 1 });
  18. schema.index({ status: 1 });
  19. schema.index({ 'meta.createdAt': 1 });
  20. schema.plugin(metaPlugin);
  21. module.exports = app => {
  22. const { mongoose } = app;
  23. return mongoose.model('Ticket_record', schema, 'ticket_record');
  24. };