'use strict'; const Schema = require('mongoose').Schema; const SchemaDefine = { // 文章或杂志ID source: { type: String, required: true }, // 用户ID target: { type: String, required: true }, // 留言信息 msg: { type: String, required: true }, // 父级id parentId: { type: String, required: true }, // 状态 0=待审核 1=已发布 2=已驳回 status: { type: String, required: true }, }; const schema = new Schema(SchemaDefine); module.exports = app => { const { mongoose } = app; return mongoose.model('leave', schema, 'leave'); };