This repository has been archived on 2025-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
rhaj/database/models/event_model.rhai
2025-04-04 08:28:07 +02:00

93 lines
2.4 KiB
Plaintext

// event_model.rhai - Event data model
// Create a new event object
fn create_event(id, title, description, start_time, end_time, location, calendar_id, organizer_id, attendees, recurring, status) {
return #{
id: id,
title: title,
description: description,
start_time: start_time,
end_time: end_time,
location: location,
calendar_id: calendar_id,
organizer_id: organizer_id,
attendees: attendees,
recurring: recurring,
status: status
};
}
// Create a recurring event object (extends regular event)
fn create_recurring_event(id, title, description, start_time, end_time, location, calendar_id, organizer_id, attendees, recurrence_pattern, status) {
let event = create_event(id, title, description, start_time, end_time, location, calendar_id, organizer_id, attendees, true, status);
event.recurrence_pattern = recurrence_pattern;
return event;
}
// Sample events data
fn get_sample_events() {
let events = [];
// Event 1: Team Meeting
events.push(create_event(
"event1",
"Team Meeting",
"Weekly team sync meeting",
"2025-04-04T10:00:00",
"2025-04-04T11:00:00",
"Conference Room A",
"cal1",
"user1",
["user1", "user2", "user3"],
false,
"confirmed"
));
// Event 2: Project Deadline
events.push(create_event(
"event2",
"Project Deadline",
"Final submission for Q2 project",
"2025-04-15T17:00:00",
"2025-04-15T18:00:00",
"Virtual",
"cal1",
"user2",
["user1", "user2", "user4"],
false,
"confirmed"
));
// Event 3: Lunch with Client
events.push(create_event(
"event3",
"Lunch with Client",
"Discuss upcoming partnership",
"2025-04-10T12:30:00",
"2025-04-10T14:00:00",
"Downtown Cafe",
"cal2",
"user1",
["user1", "user5"],
false,
"tentative"
));
// Event 4: Weekly Status Update (recurring)
events.push(create_recurring_event(
"event4",
"Weekly Status Update",
"Regular status update meeting",
"2025-04-05T09:00:00",
"2025-04-05T09:30:00",
"Conference Room B",
"cal1",
"user3",
["user1", "user2", "user3", "user4"],
"weekly",
"confirmed"
));
return events;
}