repair.js 880 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 维修单
  5. const RepairSchema = {
  6. name: { type: String, required: false, maxLength: 200 }, // 维修项目名
  7. type: { type: String, required: false, maxLength: 200 }, // 类型
  8. parts: { type: String, required: false, maxLength: 200 }, // 配件
  9. jobdate: { type: String, required: false, maxLength: 200 }, // 工时
  10. totalmoney: { type: String, required: false, maxLength: 200 }, // 合计
  11. uid: { type: String, required: true, maxLength: 500 }, // 所属用户id
  12. // ref:'Company',关联数据
  13. };
  14. const schema = new Schema(RepairSchema, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Repair', schema, 'repair');
  20. };