multy-stub/server/routers/dry-wash/model/master.js

21 lines
463 B
JavaScript
Raw Normal View History

2024-12-15 17:53:45 +03:00
const { Schema, model } = require('mongoose')
const schema = new Schema({
name: {type: String, required: true},
phone: {type: String, required: true,unique: true,},
created: {
type: Date, default: () => new Date().toISOString(),
},
})
schema.set('toJSON', {
virtuals: true,
versionKey: false,
})
schema.virtual('id').get(function () {
return this._id.toHexString()
})
exports.MasterModel = model('dry-wash-master', schema)