|
@@ -1,39 +1,41 @@
|
|
|
-"use strict";
|
|
|
-const moment = require("moment");
|
|
|
-const Schema = require("mongoose").Schema;
|
|
|
-const metaPlugin = require("naf-framework-mongoose/lib/model/meta-plugin");
|
|
|
+'use strict';
|
|
|
+const moment = require('moment');
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
// params不做限制,方便扩展,Object就行
|
|
|
const params = {
|
|
|
project: { type: String, required: true }, // 项目名称(需要设置好,然后找对应路由前置)
|
|
|
router: { type: String, required: true }, // 要执行的路由
|
|
|
- service: { type: String, required: true }, //服务
|
|
|
+ service: { type: String, required: true }, // 服务
|
|
|
method: { type: String, required: true }, // 方法, get,post,delete...
|
|
|
type: { type: String, required: false }, // 类型,需要怎么处理;例如,文件,需要下载
|
|
|
- body: { type: [Object, Array] },
|
|
|
+ body: { type: [ Object, Array ] },
|
|
|
query: { type: Object },
|
|
|
};
|
|
|
|
|
|
const Mission = {
|
|
|
- title: { type: String, required: true, maxLength: 200 }, // 教师
|
|
|
+ title: { type: String, required: true, maxLength: 200 }, // 标题
|
|
|
create_time: {
|
|
|
type: String,
|
|
|
required: false,
|
|
|
maxLength: 200,
|
|
|
- default: moment().format("YYYY-MM-DD HH:SS:mm"),
|
|
|
+ default: moment().format('YYYY-MM-DD HH:SS:mm'),
|
|
|
}, // 创建时间
|
|
|
params: { type: Object, required: false },
|
|
|
- status: { type: String, maxLength: 200, default: "0" }, // 状态:0=>未开始;1=>正在进行;2=>已完成;3=>失败
|
|
|
+ status: { type: String, maxLength: 200, default: '0' }, // 状态:0=>未开始;1=>正在进行;2=>已完成;3=>失败
|
|
|
dot: { type: Boolean, default: true }, // 需要提醒
|
|
|
progress: { type: String, required: false, maxLength: 200 },
|
|
|
user: { type: String, required: false, maxLength: 200 }, // 用户,监听指定用户用,没有的话,mq就监听项目
|
|
|
uri: { type: String, required: false }, // 文件/图片等需要地址的地方就放这
|
|
|
- tenant: { type: String, required: true }, //所属项目
|
|
|
+ tenant: { type: String, required: true }, // 所属项目
|
|
|
+ remark: { type: String },
|
|
|
};
|
|
|
const schema = new Schema(Mission, { toJSON: { virtuals: true } });
|
|
|
schema.index({ id: 1 });
|
|
|
+schema.index({ user: 1 });
|
|
|
schema.plugin(metaPlugin);
|
|
|
|
|
|
-module.exports = (app) => {
|
|
|
+module.exports = app => {
|
|
|
const { mongoose } = app;
|
|
|
- return mongoose.model("Mission", schema, "mission");
|
|
|
+ return mongoose.model('Mission', schema, 'mission');
|
|
|
};
|