carorder.js 1.1 KB

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 接车单
  5. const CarorderSchema = {
  6. name: { type: String, required: true, maxLength: 200 }, // 顾客姓名
  7. license : { type: String, required: true, maxLength: 200 }, // 车牌号
  8. mobile: { type: Number, required: true, maxLength: 200 }, // 电话
  9. model: { type: String, required: false, maxLength: 200 }, // 车型
  10. carcolor: { type: String, required: false, maxLength: 200 }, // 车辆颜色
  11. vin: { type: String, required: false, maxLength: 200 }, // vin号
  12. insurance: { type: String, required: false, maxLength: 200 }, // 保险日期
  13. drive: { type: String, required: false, maxLength: 200 }, // 驾驶证日期
  14. travel: { type: String, required: false, maxLength: 200 }, // 行驶证日期
  15. };
  16. const schema = new Schema(CarorderSchema, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.plugin(metaPlugin);
  19. module.exports = app => {
  20. const { mongoose } = app;
  21. return mongoose.model('Carorder', schema, 'carorder');
  22. };