compilation.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * 编办管理数据模型
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/28
  6. * @version
  7. */
  8. const mongoose = require('mongoose');
  9. let Schema = mongoose.Schema;
  10. let collectionName = 'compilation';
  11. let childrenSchema = new Schema({
  12. id:String,
  13. // 计价名称
  14. name: String,
  15. // 工程专业列表
  16. engineering_list: {
  17. type: Schema.Types.Mixed,
  18. default: []
  19. },
  20. // 是否启用
  21. enable: {
  22. type: Boolean,
  23. default: false
  24. },
  25. // 类型
  26. type: {
  27. type: Number
  28. }
  29. },{_id: false});
  30. let modelSchema = {
  31. // 是否发布
  32. is_release: {
  33. type: Boolean,
  34. default: false
  35. },
  36. // 清单计价规则
  37. bill_valuation: {
  38. type: [childrenSchema],
  39. default: []
  40. },
  41. // 定额计价规则
  42. ration_valuation: {
  43. type: [childrenSchema],
  44. default: []
  45. },
  46. // 名称
  47. name: String,
  48. //描述
  49. description: String,
  50. //例题
  51. example: [],
  52. //导入欢迎页项目
  53. adProjects:[],
  54. //代码覆盖路径
  55. overWriteUrl:String,
  56. // 创建时间
  57. create_time: Number,
  58. // 创建者id
  59. creator: String,
  60. // 发布时间
  61. release_time: {
  62. type: Number,
  63. default: 0
  64. },
  65. // cld 办事处id
  66. categoryID: {
  67. type: Number,
  68. default: 12 // 总部id
  69. }
  70. };
  71. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));