'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 资料评分表 const MaterialscoreSchema = { materialid: { type: String, required: true, maxLength: 200 }, // 资料id uid: { type: String, required: true, maxLength: 200 }, // 评价人id score: { type: String, required: true, maxLength: 200 }, // 评分 remark: { type: String, required: false, maxLength: 2000 }, // 评价内容 }; const schema = new Schema(MaterialscoreSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Materialscore', schema, 'materialscore'); };