12345678910111213141516171819202122232425 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 文件导入表
- const TasksSchema = {
- userid: { type: String, required: true, maxLength: 64 }, // 人员
- name: { type: String, required: false, maxLength: 200 }, // 名称
- createtime: { type: String, required: false, maxLength: 20 }, // 时间
- type: { type: String, required: false, maxLength: 64 }, // 类别
- content: { type: String, required: false, maxLength: 64 }, // 内容
- status: { type: String, required: false, maxLength: 2 }, // 状态
- mqid: { type: String, required: false }, // 发送
- errmsg: { type: String, required: false }, // 导入错误信息
- };
- const schema = new Schema(TasksSchema, { toJSON: { virtuals: true } });
- schema.index({ userid: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Tasks', schema, 'tasks');
- };
|