tNewsCenter.js 1.1 KB

123456789101112131415161718192021222324252627
  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 TNewsCenterSchema = {
  7. title: {type: String, required: true},//标题
  8. image: {type: String, required: false},//图片
  9. brief_introduction: {type: String, required: false},//简介
  10. description: {type: String, required: true},//内容
  11. publish_time: {type: Number},//发布日期
  12. publish_state: {type: String, default: '0'},//发布状态,0-未发布,1-已发布
  13. publish_state_description: {type: String, default: '未发布'},//发布状态描述,0-未发布,1-已发布
  14. source: {type: String, required: false},//来源
  15. hot: {type: String, default: '0'},//是否热门,0-否,1-是
  16. };
  17. const schema = new Schema(TNewsCenterSchema, {toJSON: {virtuals: true}});
  18. schema.index({id: 1});
  19. schema.plugin(metaPlugin);
  20. module.exports = app => {
  21. const {mongoose} = app;
  22. return mongoose.model('TNewsCenter', schema, 't_news_center');
  23. };