tasks.js 957 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 文件导入表
  5. const TasksSchema = {
  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. mqid: { type: String, required: false }, // 发送
  13. errmsg: { type: String, required: false }, // 导入错误信息
  14. };
  15. const schema = new Schema(TasksSchema, { toJSON: { virtuals: true } });
  16. schema.index({ userid: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('Tasks', schema, 'tasks');
  21. };