123456789101112131415161718192021 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 交易订单表
- const patentorder = {
- user_id: { type: ObjectId }, // 用户id
- status: { type: String }, // 状态
- remark: { type: String },
- };
- const schema = new Schema(patentorder, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ user_id: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('PatentOrder', schema, 'patent_order');
- };
|