Files
worldshine-redesign/app/models/calendar-event-recur.model.js
2026-02-10 12:59:26 -05:00

49 lines
1.5 KiB
JavaScript

module.exports = mongoose => {
var editHistorySchema = mongoose.Schema({
employee: String,
date: Date
});
var schema = mongoose.Schema(
{
// Event template data
title: String,
type: String,
description: String,
color: String,
status: String,
// value could be ['active', 'inactive']
target_type: String,
target_uuid: String,
target_name: String,
event_location: String,
event_reminder_type: String,
meal_type: String,
activity_category: String,
ingredients: String,
// Recurrence fields
rrule: String,
// rrule could be 'FREQ=DAILY', 'FREQ=WEEKLY', 'FREQ=MONTHLY', 'FREQ=YEARLY'
start_repeat_date: Date,
end_repeat_date: Date,
indefinite_repeat: Boolean,
// Metadata
create_by: String,
create_date: Date,
edit_by: String,
edit_date: Date,
edit_history: [{
type: editHistorySchema
}],
site: Number
},
{ collection: 'calendar_event_recur', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
const CalendarEventRecur = mongoose.model("calendar_event_recur", schema);
return CalendarEventRecur;
};