dataimp.js 929 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 文件导入表
  5. const DataimpSchema = {
  6. userid: { type: String, required: true, maxLength: 64 }, // 人员
  7. name: { type: String, required: false, maxLength: 200 }, // 名称
  8. createtime: { type: String, required: false, maxLength: 20 }, // 时间
  9. type: { type: String, required: false, maxLength: 64 }, // 类别
  10. content: { type: String, required: false, maxLength: 64 }, // 内容
  11. status: { type: String, required: false, maxLength: 2 }, // 状态
  12. errmsg: { type: String, required: false, maxLength: 200 }, // 导入错误信息
  13. };
  14. const schema = new Schema(DataimpSchema, { toJSON: { virtuals: true } });
  15. schema.index({ userid: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Dataimp', schema, 'data_imp');
  20. };