model.js 748 B

123456789101112131415161718192021222324252627282930313233343536
  1. const mongoose = require('mongoose')
  2. const registermapSchema = new mongoose.Schema({
  3. name: {
  4. type: String,
  5. required: true },
  6. tag: String,
  7. description: String,
  8. meta: [mongoose.Schema.Types.Mixed]
  9. })
  10. module.exports = mongoose.model('Project', registermapSchema)
  11. const settingSchema = new mongoose.Schema({
  12. name: {
  13. type: String,
  14. required: true,
  15. maxlength: 50 },
  16. tag: {
  17. type: String,
  18. maxlength: 10,
  19. required: true },
  20. description: {
  21. type: String,
  22. maxlength: 200 },
  23. group: {
  24. type: String,
  25. maxlength: 20 },
  26. bits: {
  27. type: Number,
  28. min: 1,
  29. get: (value) => Math.round(value),
  30. set: (value) => Math.round(value) }
  31. })
  32. module.exports = mongoose.model('Setting', settingSchema)