|
@@ -0,0 +1,27 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+
|
|
|
+
|
|
|
+const OptlogSchema = {
|
|
|
+ userid: { type: String, required: true, maxLength: 64 },
|
|
|
+ name: { type: String, required: false, maxLength: 200 },
|
|
|
+ unitid: { type: String, required: true, maxLength: 64 },
|
|
|
+ ip: { type: String, required: false, maxLength: 64 },
|
|
|
+ createtime: { type: String, required: false, maxLength: 20 },
|
|
|
+ type: { type: String, required: false, maxLength: 64 },
|
|
|
+ target: { type: String, required: false, maxLength: 200 },
|
|
|
+ content: { type: String, required: false, maxLength: 64 },
|
|
|
+ status: { type: String, required: false, maxLength: 2 },
|
|
|
+ remark: { type: String, required: false, maxLength: 200 },
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+const schema = new Schema(OptlogSchema, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ userid: 1 });
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('Optlog', schema, 'opt_log');
|
|
|
+};
|