apply.js 906 B

1234567891011121314151617181920212223
  1. "use strict";
  2. const Schema = require("mongoose").Schema;
  3. const moment = require("moment");
  4. const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
  5. const { ObjectId } = require("mongoose").Types;
  6. // 绩效申请表
  7. const apply = {
  8. title: { type: String }, //标题
  9. apply_year: { type: String }, // 申请年度
  10. project_info: { type: Object, default: {} }, // 项目信息
  11. apply_index: { type: Array, default: [] }, // 绩效指标
  12. status: { type: String, default: "0" }, // 0:草稿,1:待审中,2:审核通过,3:审核拒绝
  13. record: { type: Array }, // 记录
  14. remark: { type: String },
  15. };
  16. const schema = new Schema(apply, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.index({ "meta.createdAt": 1 });
  19. schema.plugin(metaPlugin);
  20. module.exports = (app) => {
  21. const { mongoose } = app;
  22. return mongoose.model("Apply", schema, "apply");
  23. };