patent_order.js 711 B

123456789101112131415161718192021
  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 patentorder = {
  8. user_id: { type: ObjectId }, // 用户id
  9. status: { type: String }, // 状态
  10. remark: { type: String },
  11. };
  12. const schema = new Schema(patentorder, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.index({ user_id: 1 });
  15. schema.index({ status: 1 });
  16. schema.index({ 'meta.createdAt': 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('PatentOrder', schema, 'patent_order');
  21. };