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

39 lines
1.0 KiB
JavaScript

module.exports = mongoose => {
var editHistorySchema = mongoose.Schema({
employee: String,
date: Date
});
var schema = mongoose.Schema(
{
customer_id: String,
customer_display: String,
source: String,
type: String,
symptom: String,
resource: String,
resource_display: String,
transportation: String,
np: String,
upload: String,
notes: [{
content: String,
author: String
}],
status: String,
create_by: String,
create_date: Date,
edit_history: [{
type: editHistorySchema
}],
site: Number
},
{ collection: 'event_request', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
const EventRequest = mongoose.model("event_request", schema);
return EventRequest;
};