worldshine-redesign/app/models/breakfast.model.js
2025-04-14 16:29:36 -04:00

29 lines
777 B
JavaScript

module.exports = mongoose => {
var editHistorySchema = mongoose.Schema({
employee: String,
date: Date
});
var schema = mongoose.Schema(
{
customer_id: String,
customer_name: String,
date: String,
has_breakfast: Boolean,
create_by: String,
create_date: Date,
edit_history: [{
type: editHistorySchema
}],
site: Number
},
{ collection: 'breakfast', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
const Breakfast = mongoose.model("breakfast", schema);
return Breakfast;
};