123456789101112131415161718192021222324 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 消息表
- const MessageSchema = {
- openid: { type: String, required: false, maxLength: 200 }, // openid
- name: { type: String, required: false, maxLength: 200 }, // openid
- title: { type: String, required: false, maxLength: 200 }, // 标题
- detail: { type: String, required: false, maxLength: 200 }, // 详细
- date: { type: String, required: false, maxLength: 200 }, // 时间
- remark: { type: String, required: false, maxLength: 200 }, // 备注
- status: { type: String, required: false, default: '0' }, // 状态 0、未读 1、已读
- };
- const schema = new Schema(MessageSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Message', schema, 'message');
- };
|