feat: add fetch masters and add model
All checks were successful
platform/multy-stub/pipeline/head This commit looks good
All checks were successful
platform/multy-stub/pipeline/head This commit looks good
This commit is contained in:
30
server/routers/dry-wash/model/order.js
Normal file
30
server/routers/dry-wash/model/order.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const { Schema, model } = require('mongoose')
|
||||
|
||||
const schema = new Schema({
|
||||
startWashTime: {type: String, required: true},
|
||||
endWashTime: {type: String, required: true},
|
||||
orderDate: {type: String, required: true},
|
||||
location: {type: String, required: true},
|
||||
phone: {type: String, required: true},
|
||||
status: {type: String, required: true},
|
||||
carNumber: {type: String, required: true},
|
||||
created: {
|
||||
type: Date, default: () => new Date().toISOString(),
|
||||
},
|
||||
updated: {
|
||||
type: Date, default: () => new Date().toISOString(),
|
||||
},
|
||||
master: {type: Schema.Types.ObjectId, ref: 'dry-wash-master'},
|
||||
notes: String,
|
||||
})
|
||||
|
||||
schema.set('toJSON', {
|
||||
virtuals: true,
|
||||
versionKey: false,
|
||||
})
|
||||
|
||||
schema.virtual('id').get(function () {
|
||||
return this._id.toHexString()
|
||||
})
|
||||
|
||||
exports.OrderModel = model('dry-wash-order', schema)
|
||||
Reference in New Issue
Block a user