'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 接车单 const CarorderSchema = { name: { type: String, required: true, maxLength: 200 }, // 顾客姓名 license : { type: String, required: true, maxLength: 200 }, // 车牌号 mobile: { type: Number, required: true, maxLength: 200 }, // 电话 model: { type: String, required: false, maxLength: 200 }, // 车型 carcolor: { type: String, required: false, maxLength: 200 }, // 车辆颜色 vin: { type: String, required: false, maxLength: 200 }, // vin号 insurance: { type: String, required: false, maxLength: 200 }, // 保险日期 drive: { type: String, required: false, maxLength: 200 }, // 驾驶证日期 travel: { type: String, required: false, maxLength: 200 }, // 行驶证日期 }; const schema = new Schema(CarorderSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Carorder', schema, 'carorder'); };