materialscore.js 740 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 资料评分表
  5. const MaterialscoreSchema = {
  6. materialid: { type: String, required: true, maxLength: 200 }, // 资料id
  7. uid: { type: String, required: true, maxLength: 200 }, // 评价人id
  8. score: { type: String, required: true, maxLength: 200 }, // 评分
  9. remark: { type: String, required: false, maxLength: 2000 }, // 评价内容
  10. };
  11. const schema = new Schema(MaterialscoreSchema, { toJSON: { virtuals: true } });
  12. schema.index({ id: 1 });
  13. schema.plugin(metaPlugin);
  14. module.exports = app => {
  15. const { mongoose } = app;
  16. return mongoose.model('Materialscore', schema, 'materialscore');
  17. };