information.js 1.0 KB

12345678910111213141516171819202122232425
  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. column_id: { type: String, required: false, maxLength: 200 }, // 栏目id
  13. state: { type: String, required: false, maxLength: 200 }, // 状态,0-草稿,1-发布,2-删除
  14. };
  15. const schema = new Schema(InformationSchema, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('Information', schema, 'talent_information');
  21. };