'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 approvalInfo = new Schema({ state: {type: String, required: false},//状态,-1-停用,0-未审核,1-审核通过,2-审核未通过 state_description: {type: String, required: false},//状态描述,-1-停用,0-未审核,1-审核通过,2-审核未通过 result_description: {type: String, required: false},//结果描述 state_time: {type: Number},//状态时间 approval_id: {type: String, required: false},//审批人id approval: {type: String, required: false},//审批人 }); // 附件 const enclosure = new Schema({ name: {type: String, required: false},//原文件名 url: {type: String, required: false},//存储文件名 }); // 政策申报内容管理 const TPolicyDeclarationSchema = { title: {type: String, required: true},//标题 issuing_organ: {type: String, required: true},//发文机关 index_number: {type: String, required: false},//索引号 subject_classification: {type: String, required: true},//主题分类 issued_number: {type: String, required: false},//发文字号 subject_headings: {type: String, required: true},//主题词 publish_time: {type: Number},//发布日期 brief_introduction: {type: String, required: false},//简介 description: {type: String, required: true},//内容 type: {type: String, required: true},//类型 ,0-工信厅,1-金融办,2-其他政府部门 type_description: {type: String, required: false},//类型描述,0-工信厅,1-金融办,2-其他政府部门 link: {type: String, required: false},//链接 current_state: {type: String, default: '0'},//状态,-1-停用,0-未审核,1-审核通过,2-审核未通过 current_state_description: {type: String, default: '未审核'},//状态描述,-1-停用,0-未审核,1-审核通过,2-审核未通过 current_result_description: {type: String, default: ''},//结果描述 current_state_time: {type: Number/*, default: Date.now*/},//状态时间 current_approval_id: {type: String, default: ''},//审批人id current_approval: {type: String, default: ''},//审批人 approval_info: {type: [approvalInfo], required: false}, // 审批信息 enclosure: {type: [enclosure], required: false}, // 附件 image: {type: String, required: false},//图片 create_time: {type: Number, default: Date.now},//创建时间 update_time: {type: Number, default: Date.now},//更新时间 }; const schema = new Schema(TPolicyDeclarationSchema, {toJSON: {virtuals: true}}); schema.index({id: 1}); schema.plugin(metaPlugin); module.exports = app => { const {mongoose} = app; return mongoose.model('TPolicyDeclaration', schema, 't_policy_declaration'); };