carorder.js 1.1 KB

12345678910111213141516171819202122232425
  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. mileage: { type: String, required: false, maxLength: 200 }, // 行驶里程
  12. vin: { type: String, required: false, maxLength: 200 }, // vin号
  13. insurance: { type: String, required: false, maxLength: 200 }, // 保险日期
  14. drive: { type: String, required: false, maxLength: 200 }, // 驾驶证日期
  15. travel: { type: String, required: false, maxLength: 200 }, // 行驶证日期
  16. };
  17. const schema = new Schema(CarorderSchema, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.plugin(metaPlugin);
  20. module.exports = app => {
  21. const { mongoose } = app;
  22. return mongoose.model('Carorder', schema, 'carorder');
  23. };