123456789101112131415161718192021222324252627 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 操作日志表
- const OptlogSchema = {
- userid: { type: String, required: false, maxLength: 200 }, // 操作人id
- name: { type: String, required: false, maxLength: 200 }, // 操作人名称
- type: { type: String, required: false, maxLength: 200 }, // 操作人类别
- optmethod: { type: String, required: false }, // 操作方法
- optservice: { type: String, required: false }, // 操作接口
- optdata: { type: String, required: false }, // 操作数据
- opttime: { type: String, required: false }, // 操作时间
- status: { type: String, required: false }, // 操作状态
- };
- const schema = new Schema(OptlogSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ opttime: 1 });
- schema.index({ type: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Optlog', schema, 'optlog');
- };
|