arrange.js 689 B

1234567891011121314151617181920
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 安排表
  7. const arrange = {
  8. date: { type: String, required: true }, // 日期
  9. arrange: { type: Object }, // 安排
  10. remark: { type: String },
  11. };
  12. const schema = new Schema(arrange, { 'multi-tenancy': true, toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.index({ date: 1 });
  15. schema.index({ 'meta.createdAt': 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Arrange', schema, 'arrange');
  20. };