12345678910111213141516171819202122232425 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { Secret } = require('naf-framework-mongoose/lib/model/schema');
- // 参谋表
- const InformationSchema = {
- infotype: { type: String, required: true, maxLength: 200 }, // 信息类型
- name: { type: String, required: true, maxLength: 500 }, // 名称
- content: { type: String, required: true }, // 正文
- user_id: { type: String, required: true, maxLength: 200 }, // 发布人id
- user_name: { type: String, required: true, maxLength: 200 }, // 发布人名称
- column_id: { type: String, required: false, maxLength: 200 }, // 栏目id
- state: { type: String, required: false, maxLength: 200 }, // 状态,0-草稿,1-发布,2-删除
- };
- const schema = new Schema(InformationSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Information', schema, 'talent_information');
- };
|