worldshine-redesign/app/models/vehicle-repair.model.js
2025-06-13 22:48:05 -04:00

22 lines
566 B
JavaScript

module.exports = mongoose => {
var schema = mongoose.Schema(
{
repair_date: String,
site: Number,
repair_description: String,
repair_price: String,
repair_location: String,
vehicle: String,
create_date: Date
},
{ collection: 'vehicle_repair', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
schema.index({tag: 1, site:1}, {unique: true});
const VehicleRepair = mongoose.model("vehicle_repair", schema);
return VehicleRepair;
};