'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; // 安排表 const arrange = { date: { type: String, required: true }, // 日期 arrange: { type: Object }, // 安排 remark: { type: String }, }; const schema = new Schema(arrange, { 'multi-tenancy': true, toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ date: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Arrange', schema, 'arrange'); };