information.js 970 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  5. // 参谋表
  6. const InformationSchema = {
  7. infotype: { type: String, required: true, maxLength: 200 }, // 信息类型
  8. name: { type: String, required: true, maxLength: 500 }, // 名称
  9. content: { type: String, required: true }, // 正文
  10. user_id: { type: String, required: true, maxLength: 200 }, // 发布人id
  11. user_name: { type: String, required: true, maxLength: 200 }, // 发布人名称
  12. state: { type: String, required: false, maxLength: 200 }, // 状态,0-草稿,1-发布,2-删除
  13. };
  14. const schema = new Schema(InformationSchema, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Information', schema, 'talent_information');
  20. };