feat: Enhance calendar example with user and attendee management
- Add user creation and management to the calendar example. - Integrate user IDs into attendees for improved data integrity. - Improve event manipulation by adding and removing attendees by ID. - Enhance calendar example to demonstrate event and calendar retrieval. - Enhance the calendar example with database storage for events. - Modify the calendar example to manage events by ID instead of title.
This commit is contained in:
parent
d8e3d48caa
commit
331915c6cb
@ -1,6 +1,7 @@
|
|||||||
use chrono::{Duration, Utc};
|
use chrono::{Duration, Utc};
|
||||||
use heromodels::db::{Collection, Db};
|
use heromodels::db::{Collection, Db};
|
||||||
use heromodels::models::calendar::{Attendee, AttendanceStatus, Calendar, Event};
|
use heromodels::models::User;
|
||||||
|
use heromodels::models::calendar::{AttendanceStatus, Attendee, Calendar, Event};
|
||||||
use heromodels_core::Model;
|
use heromodels_core::Model;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -11,122 +12,401 @@ fn main() {
|
|||||||
println!("Hero Models - Calendar Usage Example");
|
println!("Hero Models - Calendar Usage Example");
|
||||||
println!("====================================");
|
println!("====================================");
|
||||||
|
|
||||||
|
// --- Create Users First ---
|
||||||
|
println!("\n--- Creating Users ---");
|
||||||
|
let user1 = User::new()
|
||||||
|
.username("alice_johnson")
|
||||||
|
.email("alice.johnson@company.com")
|
||||||
|
.full_name("Alice Johnson")
|
||||||
|
.is_active(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let user2 = User::new()
|
||||||
|
.username("bob_smith")
|
||||||
|
.email("bob.smith@company.com")
|
||||||
|
.full_name("Bob Smith")
|
||||||
|
.is_active(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let user3 = User::new()
|
||||||
|
.username("carol_davis")
|
||||||
|
.email("carol.davis@company.com")
|
||||||
|
.full_name("Carol Davis")
|
||||||
|
.is_active(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Store users in database and get their IDs
|
||||||
|
let user_collection = db.collection::<User>().expect("can open user collection");
|
||||||
|
|
||||||
|
let (user1_id, stored_user1) = user_collection.set(&user1).expect("can set user1");
|
||||||
|
let (user2_id, stored_user2) = user_collection.set(&user2).expect("can set user2");
|
||||||
|
let (user3_id, stored_user3) = user_collection.set(&user3).expect("can set user3");
|
||||||
|
|
||||||
|
println!("Created users:");
|
||||||
|
println!("- User 1 (ID: {}): {}", user1_id, stored_user1.full_name);
|
||||||
|
println!("- User 2 (ID: {}): {}", user2_id, stored_user2.full_name);
|
||||||
|
println!("- User 3 (ID: {}): {}", user3_id, stored_user3.full_name);
|
||||||
|
|
||||||
// --- Create Attendees ---
|
// --- Create Attendees ---
|
||||||
let attendee1 = Attendee::new("user_123".to_string())
|
println!("\n--- Creating Attendees ---");
|
||||||
.status(AttendanceStatus::Accepted);
|
let attendee1 = Attendee::new(user1_id).status(AttendanceStatus::Accepted);
|
||||||
let attendee2 = Attendee::new("user_456".to_string())
|
let attendee2 = Attendee::new(user2_id).status(AttendanceStatus::Tentative);
|
||||||
.status(AttendanceStatus::Tentative);
|
let attendee3 = Attendee::new(user3_id); // Default NoResponse
|
||||||
let attendee3 = Attendee::new("user_789".to_string()); // Default NoResponse
|
|
||||||
|
|
||||||
// --- Create Events ---
|
// Store attendees in database and get their IDs
|
||||||
let now = Utc::now();
|
let attendee_collection = db
|
||||||
let event1 = Event::new(
|
.collection::<Attendee>()
|
||||||
"event_alpha".to_string(),
|
.expect("can open attendee collection");
|
||||||
"Team Meeting",
|
|
||||||
now + Duration::seconds(3600), // Using Duration::seconds for more explicit chrono 0.4 compatibility
|
|
||||||
now + Duration::seconds(7200),
|
|
||||||
)
|
|
||||||
.description("Weekly sync-up meeting.")
|
|
||||||
.location("Conference Room A")
|
|
||||||
.add_attendee(attendee1.clone())
|
|
||||||
.add_attendee(attendee2.clone());
|
|
||||||
|
|
||||||
let event2 = Event::new(
|
let (attendee1_id, stored_attendee1) = attendee_collection
|
||||||
"event_beta".to_string(),
|
.set(&attendee1)
|
||||||
"Project Brainstorm",
|
.expect("can set attendee1");
|
||||||
now + Duration::days(1),
|
let (attendee2_id, stored_attendee2) = attendee_collection
|
||||||
now + Duration::days(1) + Duration::seconds(5400), // 90 minutes
|
.set(&attendee2)
|
||||||
)
|
.expect("can set attendee2");
|
||||||
.description("Brainstorming session for new project features.")
|
let (attendee3_id, stored_attendee3) = attendee_collection
|
||||||
.add_attendee(attendee1.clone())
|
.set(&attendee3)
|
||||||
.add_attendee(attendee3.clone());
|
.expect("can set attendee3");
|
||||||
|
|
||||||
let event3_for_calendar2 = Event::new(
|
println!("Created attendees:");
|
||||||
"event_gamma".to_string(),
|
println!(
|
||||||
"Client Call",
|
"- Attendee 1 (ID: {}): Contact ID {}, Status: {:?}",
|
||||||
now + Duration::days(2),
|
attendee1_id, stored_attendee1.contact_id, stored_attendee1.status
|
||||||
now + Duration::days(2) + Duration::seconds(3600)
|
);
|
||||||
|
println!(
|
||||||
|
"- Attendee 2 (ID: {}): Contact ID {}, Status: {:?}",
|
||||||
|
attendee2_id, stored_attendee2.contact_id, stored_attendee2.status
|
||||||
|
);
|
||||||
|
println!(
|
||||||
|
"- Attendee 3 (ID: {}): Contact ID {}, Status: {:?}",
|
||||||
|
attendee3_id, stored_attendee3.contact_id, stored_attendee3.status
|
||||||
);
|
);
|
||||||
|
|
||||||
// --- Create Calendars ---
|
// --- Create Events with Attendees ---
|
||||||
// Note: Calendar::new directly returns Calendar, no separate .build() step like the user example.
|
println!("\n--- Creating Events with Attendees ---");
|
||||||
|
let now = Utc::now();
|
||||||
|
|
||||||
// Create a calendar with auto-generated ID
|
let event1 = Event::new(
|
||||||
|
"Team Meeting",
|
||||||
|
now + Duration::hours(1),
|
||||||
|
now + Duration::hours(2),
|
||||||
|
)
|
||||||
|
.description("Weekly sync-up meeting to discuss project progress.")
|
||||||
|
.location("Conference Room A")
|
||||||
|
.add_attendee(attendee1_id)
|
||||||
|
.add_attendee(attendee2_id);
|
||||||
|
|
||||||
|
let event2 = Event::new(
|
||||||
|
"Project Brainstorm",
|
||||||
|
now + Duration::days(1),
|
||||||
|
now + Duration::days(1) + Duration::minutes(90),
|
||||||
|
)
|
||||||
|
.description("Brainstorming session for new project features.")
|
||||||
|
.location("Innovation Lab")
|
||||||
|
.add_attendee(attendee1_id)
|
||||||
|
.add_attendee(attendee3_id);
|
||||||
|
|
||||||
|
let event3 = Event::new(
|
||||||
|
"Client Call",
|
||||||
|
now + Duration::days(2),
|
||||||
|
now + Duration::days(2) + Duration::hours(1),
|
||||||
|
)
|
||||||
|
.description("Quarterly review with key client.")
|
||||||
|
.add_attendee(attendee2_id);
|
||||||
|
|
||||||
|
println!("Created events:");
|
||||||
|
println!(
|
||||||
|
"- Event 1: '{}' at {} with {} attendees",
|
||||||
|
event1.title,
|
||||||
|
event1.start_time.format("%Y-%m-%d %H:%M"),
|
||||||
|
event1.attendees.len()
|
||||||
|
);
|
||||||
|
println!(
|
||||||
|
" Location: {}",
|
||||||
|
event1
|
||||||
|
.location
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_or(&"Not specified".to_string())
|
||||||
|
);
|
||||||
|
println!(" Attendee IDs: {:?}", event1.attendees);
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"- Event 2: '{}' at {} with {} attendees",
|
||||||
|
event2.title,
|
||||||
|
event2.start_time.format("%Y-%m-%d %H:%M"),
|
||||||
|
event2.attendees.len()
|
||||||
|
);
|
||||||
|
println!(
|
||||||
|
" Location: {}",
|
||||||
|
event2
|
||||||
|
.location
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_or(&"Not specified".to_string())
|
||||||
|
);
|
||||||
|
println!(" Attendee IDs: {:?}", event2.attendees);
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"- Event 3: '{}' at {} with {} attendees",
|
||||||
|
event3.title,
|
||||||
|
event3.start_time.format("%Y-%m-%d %H:%M"),
|
||||||
|
event3.attendees.len()
|
||||||
|
);
|
||||||
|
println!(" Attendee IDs: {:?}", event3.attendees);
|
||||||
|
|
||||||
|
// --- Demonstrate Event Manipulation ---
|
||||||
|
println!("\n--- Demonstrating Event Manipulation ---");
|
||||||
|
|
||||||
|
// Reschedule an event
|
||||||
|
let new_start = now + Duration::hours(2);
|
||||||
|
let new_end = now + Duration::hours(3);
|
||||||
|
let mut updated_event1 = event1.clone();
|
||||||
|
updated_event1 = updated_event1.reschedule(new_start, new_end);
|
||||||
|
println!(
|
||||||
|
"Rescheduled '{}' to {}",
|
||||||
|
updated_event1.title,
|
||||||
|
new_start.format("%Y-%m-%d %H:%M")
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove an attendee
|
||||||
|
updated_event1 = updated_event1.remove_attendee(attendee1_id);
|
||||||
|
println!(
|
||||||
|
"Removed attendee {} from '{}'. Remaining attendee IDs: {:?}",
|
||||||
|
attendee1_id, updated_event1.title, updated_event1.attendees
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add a new attendee
|
||||||
|
updated_event1 = updated_event1.add_attendee(attendee3_id);
|
||||||
|
println!(
|
||||||
|
"Added attendee {} to '{}'. Current attendee IDs: {:?}",
|
||||||
|
attendee3_id, updated_event1.title, updated_event1.attendees
|
||||||
|
);
|
||||||
|
|
||||||
|
// --- Store Events in Database ---
|
||||||
|
// Now that Event is a proper database model, we need to store events first
|
||||||
|
println!("\n--- Storing Events in Database ---");
|
||||||
|
|
||||||
|
let event_collection = db.collection::<Event>().expect("can open event collection");
|
||||||
|
|
||||||
|
// Store events and get their auto-generated IDs
|
||||||
|
let (event1_id, stored_event1) = event_collection.set(&event1).expect("can set event1");
|
||||||
|
let (event2_id, stored_event2) = event_collection.set(&event2).expect("can set event2");
|
||||||
|
let (event3_id, stored_event3) = event_collection.set(&event3).expect("can set event3");
|
||||||
|
|
||||||
|
println!("Stored events in database:");
|
||||||
|
println!("- Event ID {}: '{}'", event1_id, stored_event1.title);
|
||||||
|
println!("- Event ID {}: '{}'", event2_id, stored_event2.title);
|
||||||
|
println!("- Event ID {}: '{}'", event3_id, stored_event3.title);
|
||||||
|
|
||||||
|
// --- Create Calendars ---
|
||||||
|
// Now calendars store the actual database IDs of the events
|
||||||
|
println!("\n--- Creating Calendars ---");
|
||||||
|
|
||||||
|
// Create a calendar with auto-generated ID and the stored event IDs
|
||||||
let calendar1 = Calendar::new(None, "Work Calendar")
|
let calendar1 = Calendar::new(None, "Work Calendar")
|
||||||
.description("Calendar for all work-related events.")
|
.description("Calendar for all work-related events.")
|
||||||
.add_event(event1.clone())
|
.add_event(event1_id as i64)
|
||||||
.add_event(event2.clone());
|
.add_event(event2_id as i64);
|
||||||
|
|
||||||
// Create a calendar with auto-generated ID (explicit IDs are no longer supported)
|
// Create another calendar with auto-generated ID
|
||||||
let calendar2 = Calendar::new(None, "Personal Calendar")
|
let calendar2 = Calendar::new(None, "Personal Calendar").add_event(event3_id as i64);
|
||||||
.add_event(event3_for_calendar2.clone());
|
|
||||||
|
|
||||||
|
println!("Created calendars with event IDs:");
|
||||||
|
println!(
|
||||||
|
"- Calendar 1: '{}' with events: {:?}",
|
||||||
|
calendar1.name, calendar1.events
|
||||||
|
);
|
||||||
|
println!(
|
||||||
|
"- Calendar 2: '{}' with events: {:?}",
|
||||||
|
calendar2.name, calendar2.events
|
||||||
|
);
|
||||||
|
|
||||||
// --- Store Calendars in DB ---
|
// --- Store Calendars in DB ---
|
||||||
let cal_collection = db.collection::<Calendar>().expect("can open calendar collection");
|
let cal_collection = db
|
||||||
|
.collection::<Calendar>()
|
||||||
|
.expect("can open calendar collection");
|
||||||
|
|
||||||
let (_, calendar1) = cal_collection.set(&calendar1).expect("can set calendar1");
|
let (_, calendar1) = cal_collection.set(&calendar1).expect("can set calendar1");
|
||||||
let (_, calendar2) = cal_collection.set(&calendar2).expect("can set calendar2");
|
let (_, calendar2) = cal_collection.set(&calendar2).expect("can set calendar2");
|
||||||
|
|
||||||
println!("Created calendar1 (ID: {}): Name - '{}'", calendar1.get_id(), calendar1.name);
|
println!(
|
||||||
println!("Created calendar2 (ID: {}): Name - '{}'", calendar2.get_id(), calendar2.name);
|
"Created calendar1 (ID: {}): Name - '{}'",
|
||||||
|
calendar1.get_id(),
|
||||||
|
calendar1.name
|
||||||
|
);
|
||||||
|
println!(
|
||||||
|
"Created calendar2 (ID: {}): Name - '{}'",
|
||||||
|
calendar2.get_id(),
|
||||||
|
calendar2.name
|
||||||
|
);
|
||||||
|
|
||||||
// --- Retrieve a Calendar by ID ---
|
// --- Retrieve a Calendar by ID ---
|
||||||
let stored_calendar1_opt = cal_collection.get_by_id(calendar1.get_id()).expect("can try to load calendar1");
|
let stored_calendar1_opt = cal_collection
|
||||||
assert!(stored_calendar1_opt.is_some(), "Calendar1 should be found in DB");
|
.get_by_id(calendar1.get_id())
|
||||||
|
.expect("can try to load calendar1");
|
||||||
|
assert!(
|
||||||
|
stored_calendar1_opt.is_some(),
|
||||||
|
"Calendar1 should be found in DB"
|
||||||
|
);
|
||||||
let mut stored_calendar1 = stored_calendar1_opt.unwrap();
|
let mut stored_calendar1 = stored_calendar1_opt.unwrap();
|
||||||
|
|
||||||
println!("\nRetrieved calendar1 from DB: Name - '{}', Events count: {}", stored_calendar1.name, stored_calendar1.events.len());
|
println!(
|
||||||
|
"\nRetrieved calendar1 from DB: Name - '{}', Events count: {}",
|
||||||
|
stored_calendar1.name,
|
||||||
|
stored_calendar1.events.len()
|
||||||
|
);
|
||||||
assert_eq!(stored_calendar1.name, "Work Calendar");
|
assert_eq!(stored_calendar1.name, "Work Calendar");
|
||||||
assert_eq!(stored_calendar1.events.len(), 2);
|
assert_eq!(stored_calendar1.events.len(), 2);
|
||||||
assert_eq!(stored_calendar1.events[0].title, "Team Meeting");
|
assert_eq!(stored_calendar1.events[0], event1_id as i64); // Check event ID
|
||||||
|
|
||||||
// --- Modify a Calendar (Reschedule an Event) ---
|
// --- Modify a Calendar (Add/Remove Events) ---
|
||||||
let event_id_to_reschedule = event1.id.as_str();
|
// Since events are just IDs, we can add and remove them easily
|
||||||
let new_start_time = now + Duration::seconds(10800); // 3 hours from now
|
println!("\n--- Modifying Calendar ---");
|
||||||
let new_end_time = now + Duration::seconds(14400); // 4 hours from now
|
|
||||||
|
|
||||||
stored_calendar1 = stored_calendar1.update_event(event_id_to_reschedule, |event_to_update| {
|
// Create and store a new event
|
||||||
println!("Rescheduling event '{}'...", event_to_update.title);
|
let new_event = Event::new(
|
||||||
event_to_update.reschedule(new_start_time, new_end_time)
|
"1-on-1 Meeting",
|
||||||
});
|
now + Duration::days(3),
|
||||||
|
now + Duration::days(3) + Duration::minutes(30),
|
||||||
|
)
|
||||||
|
.description("One-on-one meeting with team member.")
|
||||||
|
.location("Office");
|
||||||
|
|
||||||
let rescheduled_event = stored_calendar1.events.iter().find(|e| e.id == event_id_to_reschedule)
|
let (new_event_id, _stored_new_event) =
|
||||||
.expect("Rescheduled event should exist");
|
event_collection.set(&new_event).expect("can set new event");
|
||||||
assert_eq!(rescheduled_event.start_time, new_start_time);
|
println!("Created new event with ID: {}", new_event_id);
|
||||||
assert_eq!(rescheduled_event.end_time, new_end_time);
|
|
||||||
println!("Event '{}' rescheduled in stored_calendar1.", rescheduled_event.title);
|
// Add the new event ID to the calendar
|
||||||
|
stored_calendar1 = stored_calendar1.add_event(new_event_id as i64);
|
||||||
|
assert_eq!(stored_calendar1.events.len(), 3);
|
||||||
|
println!(
|
||||||
|
"Added event ID {} to calendar1. Total events: {}",
|
||||||
|
new_event_id,
|
||||||
|
stored_calendar1.events.len()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove an event ID from the calendar
|
||||||
|
stored_calendar1 = stored_calendar1.remove_event(event2_id as i64); // Remove "Project Brainstorm"
|
||||||
|
assert_eq!(stored_calendar1.events.len(), 2);
|
||||||
|
println!(
|
||||||
|
"Removed event ID {} from calendar1. Total events: {}",
|
||||||
|
event2_id,
|
||||||
|
stored_calendar1.events.len()
|
||||||
|
);
|
||||||
|
|
||||||
// --- Store the modified calendar ---
|
// --- Store the modified calendar ---
|
||||||
let (_, mut stored_calendar1) = cal_collection.set(&stored_calendar1).expect("can set modified calendar1");
|
let (_, _stored_calendar1) = cal_collection
|
||||||
let re_retrieved_calendar1_opt = cal_collection.get_by_id(calendar1.get_id()).expect("can try to load modified calendar1");
|
.set(&stored_calendar1)
|
||||||
|
.expect("can set modified calendar1");
|
||||||
|
|
||||||
|
// Verify the changes were persisted
|
||||||
|
let re_retrieved_calendar1_opt = cal_collection
|
||||||
|
.get_by_id(calendar1.get_id())
|
||||||
|
.expect("can try to load modified calendar1");
|
||||||
let re_retrieved_calendar1 = re_retrieved_calendar1_opt.unwrap();
|
let re_retrieved_calendar1 = re_retrieved_calendar1_opt.unwrap();
|
||||||
let re_retrieved_event = re_retrieved_calendar1.events.iter().find(|e| e.id == event_id_to_reschedule)
|
assert_eq!(re_retrieved_calendar1.events.len(), 2);
|
||||||
.expect("Rescheduled event should exist in re-retrieved calendar");
|
assert!(re_retrieved_calendar1.events.contains(&(event1_id as i64))); // Team Meeting still there
|
||||||
assert_eq!(re_retrieved_event.start_time, new_start_time, "Reschedule not persisted correctly");
|
assert!(
|
||||||
|
re_retrieved_calendar1
|
||||||
|
.events
|
||||||
|
.contains(&(new_event_id as i64))
|
||||||
|
); // New event added
|
||||||
|
assert!(!re_retrieved_calendar1.events.contains(&(event2_id as i64))); // Project Brainstorm removed
|
||||||
|
|
||||||
println!("\nModified and re-saved calendar1. Rescheduled event start time: {}", re_retrieved_event.start_time);
|
println!(
|
||||||
|
"\nModified and re-saved calendar1. Final events: {:?}",
|
||||||
// --- Add a new event to an existing calendar ---
|
re_retrieved_calendar1.events
|
||||||
let event4_new = Event::new(
|
|
||||||
"event_delta".to_string(),
|
|
||||||
"1-on-1",
|
|
||||||
now + Duration::days(3),
|
|
||||||
now + Duration::days(3) + Duration::seconds(1800) // 30 minutes
|
|
||||||
);
|
);
|
||||||
stored_calendar1 = stored_calendar1.add_event(event4_new);
|
|
||||||
assert_eq!(stored_calendar1.events.len(), 3);
|
|
||||||
let (_, stored_calendar1) = cal_collection.set(&stored_calendar1).expect("can set calendar1 after adding new event");
|
|
||||||
println!("Added new event '1-on-1' to stored_calendar1. Total events: {}", stored_calendar1.events.len());
|
|
||||||
|
|
||||||
// --- Delete a Calendar ---
|
// --- Delete a Calendar ---
|
||||||
cal_collection.delete_by_id(calendar2.get_id()).expect("can delete calendar2");
|
cal_collection
|
||||||
let deleted_calendar2_opt = cal_collection.get_by_id(calendar2.get_id()).expect("can try to load deleted calendar2");
|
.delete_by_id(calendar2.get_id())
|
||||||
assert!(deleted_calendar2_opt.is_none(), "Calendar2 should be deleted from DB");
|
.expect("can delete calendar2");
|
||||||
|
let deleted_calendar2_opt = cal_collection
|
||||||
|
.get_by_id(calendar2.get_id())
|
||||||
|
.expect("can try to load deleted calendar2");
|
||||||
|
assert!(
|
||||||
|
deleted_calendar2_opt.is_none(),
|
||||||
|
"Calendar2 should be deleted from DB"
|
||||||
|
);
|
||||||
|
|
||||||
println!("\nDeleted calendar2 (ID: {}) from DB.", calendar2.get_id());
|
println!("\nDeleted calendar2 (ID: {}) from DB.", calendar2.get_id());
|
||||||
println!("Calendar model DB Prefix: {}", Calendar::db_prefix());
|
println!("Calendar model DB Prefix: {}", Calendar::db_prefix());
|
||||||
|
|
||||||
|
// --- Demonstrate Event Retrieval ---
|
||||||
|
println!("\n--- Retrieving Events from Database ---");
|
||||||
|
|
||||||
|
// Get all events
|
||||||
|
let all_events = event_collection.get_all().expect("can list all events");
|
||||||
|
println!("All events in database:");
|
||||||
|
for event in &all_events {
|
||||||
|
println!(
|
||||||
|
"- Event ID: {}, Title: '{}', Start: {}, Attendees: {}",
|
||||||
|
event.get_id(),
|
||||||
|
event.title,
|
||||||
|
event.start_time.format("%Y-%m-%d %H:%M"),
|
||||||
|
event.attendees.len()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
println!("Total events in DB: {}", all_events.len());
|
||||||
|
|
||||||
|
// Retrieve specific events by ID and show attendee details
|
||||||
|
println!("\nRetrieving specific events:");
|
||||||
|
if let Some(retrieved_event1) = event_collection
|
||||||
|
.get_by_id(event1_id)
|
||||||
|
.expect("can try to get event1")
|
||||||
|
{
|
||||||
|
println!(
|
||||||
|
"Retrieved Event 1: '{}' with {} attendees",
|
||||||
|
retrieved_event1.title,
|
||||||
|
retrieved_event1.attendees.len()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Look up attendee details for each attendee ID
|
||||||
|
for &attendee_id in &retrieved_event1.attendees {
|
||||||
|
if let Some(attendee) = attendee_collection
|
||||||
|
.get_by_id(attendee_id)
|
||||||
|
.expect("can try to get attendee")
|
||||||
|
{
|
||||||
|
// Look up user details for the attendee's contact_id
|
||||||
|
if let Some(user) = user_collection
|
||||||
|
.get_by_id(attendee.contact_id)
|
||||||
|
.expect("can try to get user")
|
||||||
|
{
|
||||||
|
println!(
|
||||||
|
" - Attendee ID {}: {} (User: {}, Status: {:?})",
|
||||||
|
attendee_id, user.full_name, attendee.contact_id, attendee.status
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- List All Calendars ---
|
||||||
|
println!("\n--- Listing All Calendars ---");
|
||||||
|
let all_calendars = cal_collection.get_all().expect("can list all calendars");
|
||||||
|
for calendar in &all_calendars {
|
||||||
|
println!(
|
||||||
|
"- Calendar ID: {}, Name: '{}', Events: {:?}",
|
||||||
|
calendar.get_id(),
|
||||||
|
calendar.name,
|
||||||
|
calendar.events
|
||||||
|
);
|
||||||
|
|
||||||
|
// Show which events are in this calendar
|
||||||
|
for &event_id in &calendar.events {
|
||||||
|
if let Some(event) = event_collection
|
||||||
|
.get_by_id(event_id as u32)
|
||||||
|
.expect("can try to get event")
|
||||||
|
{
|
||||||
|
println!(" * Event: '{}'", event.title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println!("Total calendars in DB: {}", all_calendars.len());
|
||||||
|
|
||||||
println!("\nExample finished. DB stored at {}", db_path);
|
println!("\nExample finished. DB stored at {}", db_path);
|
||||||
println!("To clean up, you can manually delete the directory: {}", db_path);
|
println!(
|
||||||
|
"To clean up, you can manually delete the directory: {}",
|
||||||
|
db_path
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,50 @@
|
|||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use heromodels_core::BaseModelData;
|
use heromodels_core::BaseModelData;
|
||||||
use heromodels_derive::model;
|
use heromodels_derive::model;
|
||||||
use rhai_autobind_macros::rhai_model_export;
|
|
||||||
use rhai::{CustomType, TypeBuilder};
|
use rhai::{CustomType, TypeBuilder};
|
||||||
|
use rhai_autobind_macros::rhai_model_export;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Represents the status of an attendee for an event
|
/// Represents the status of an attendee for an event
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
pub enum AttendanceStatus {
|
pub enum AttendanceStatus {
|
||||||
Accepted,
|
Accepted = 0,
|
||||||
Declined,
|
Declined = 1,
|
||||||
Tentative,
|
Tentative = 2,
|
||||||
NoResponse,
|
NoResponse = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents an attendee of an event
|
/// Represents an attendee of an event
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType)]
|
#[model]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
pub struct Attendee {
|
pub struct Attendee {
|
||||||
|
/// Base model data
|
||||||
|
pub base_data: BaseModelData,
|
||||||
/// ID of the user attending
|
/// ID of the user attending
|
||||||
// Assuming user_id might be queryable
|
|
||||||
pub contact_id: u32,
|
pub contact_id: u32,
|
||||||
/// Attendance status of the user for the event
|
/// Attendance status of the user for the event
|
||||||
pub status: AttendanceStatus,
|
pub status: AttendanceStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Attendee {
|
impl Attendee {
|
||||||
|
/// Creates a new attendee with auto-generated ID
|
||||||
pub fn new(contact_id: u32) -> Self {
|
pub fn new(contact_id: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
base_data: BaseModelData::new(), // ID will be auto-generated by OurDB
|
||||||
|
contact_id,
|
||||||
|
status: AttendanceStatus::NoResponse,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates a new attendee with optional ID (use None for auto-generated ID)
|
||||||
|
pub fn new_with_id(id: Option<u32>, contact_id: u32) -> Self {
|
||||||
|
let mut base_data = BaseModelData::new();
|
||||||
|
if let Some(id) = id {
|
||||||
|
base_data.update_id(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Self {
|
||||||
|
base_data,
|
||||||
contact_id,
|
contact_id,
|
||||||
status: AttendanceStatus::NoResponse,
|
status: AttendanceStatus::NoResponse,
|
||||||
}
|
}
|
||||||
@ -39,10 +57,10 @@ impl Attendee {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents an event in a calendar
|
/// Represents an event in a calendar
|
||||||
|
#[model]
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType)]
|
||||||
pub struct Event {
|
pub struct Event {
|
||||||
/// Base model data
|
/// Base model data
|
||||||
#[serde(flatten)]
|
|
||||||
pub base_data: BaseModelData,
|
pub base_data: BaseModelData,
|
||||||
/// Title of the event
|
/// Title of the event
|
||||||
pub title: String,
|
pub title: String,
|
||||||
@ -52,17 +70,40 @@ pub struct Event {
|
|||||||
pub start_time: DateTime<Utc>,
|
pub start_time: DateTime<Utc>,
|
||||||
/// End time of the event
|
/// End time of the event
|
||||||
pub end_time: DateTime<Utc>,
|
pub end_time: DateTime<Utc>,
|
||||||
/// List of attendees for the event
|
/// List of attendee IDs for the event
|
||||||
pub attendees: Vec<Attendee>,
|
pub attendees: Vec<u32>,
|
||||||
/// Optional location of the event
|
/// Optional location of the event
|
||||||
pub location: Option<String>,
|
pub location: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Event {
|
impl Event {
|
||||||
/// Creates a new event
|
/// Creates a new event with auto-generated ID
|
||||||
pub fn new(title: impl ToString, start_time: DateTime<Utc>, end_time: DateTime<Utc>) -> Self {
|
pub fn new(title: impl ToString, start_time: DateTime<Utc>, end_time: DateTime<Utc>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
base_data: BaseModelData::new(),
|
base_data: BaseModelData::new(), // ID will be auto-generated by OurDB
|
||||||
|
title: title.to_string(),
|
||||||
|
description: None,
|
||||||
|
start_time,
|
||||||
|
end_time,
|
||||||
|
attendees: Vec::new(),
|
||||||
|
location: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates a new event with optional ID (use None for auto-generated ID)
|
||||||
|
pub fn new_with_id(
|
||||||
|
id: Option<u32>,
|
||||||
|
title: impl ToString,
|
||||||
|
start_time: DateTime<Utc>,
|
||||||
|
end_time: DateTime<Utc>,
|
||||||
|
) -> Self {
|
||||||
|
let mut base_data = BaseModelData::new();
|
||||||
|
if let Some(id) = id {
|
||||||
|
base_data.update_id(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Self {
|
||||||
|
base_data,
|
||||||
title: title.to_string(),
|
title: title.to_string(),
|
||||||
description: None,
|
description: None,
|
||||||
start_time,
|
start_time,
|
||||||
@ -90,26 +131,18 @@ impl Event {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds an attendee to the event
|
/// Adds an attendee ID to the event
|
||||||
pub fn add_attendee(mut self, attendee: Attendee) -> Self {
|
pub fn add_attendee(mut self, attendee_id: u32) -> Self {
|
||||||
// Prevent duplicate attendees by contact_id
|
// Prevent duplicate attendees by ID
|
||||||
if !self.attendees.iter().any(|a| a.contact_id == attendee.contact_id) {
|
if !self.attendees.iter().any(|&a_id| a_id == attendee_id) {
|
||||||
self.attendees.push(attendee);
|
self.attendees.push(attendee_id);
|
||||||
}
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes an attendee from the event by user_id
|
/// Removes an attendee from the event by attendee ID
|
||||||
pub fn remove_attendee(mut self, contact_id: u32) -> Self {
|
pub fn remove_attendee(mut self, attendee_id: u32) -> Self {
|
||||||
self.attendees.retain(|a| a.contact_id != contact_id);
|
self.attendees.retain(|&a_id| a_id != attendee_id);
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates the status of an existing attendee
|
|
||||||
pub fn update_attendee_status(mut self, contact_id: u32, status: AttendanceStatus) -> Self {
|
|
||||||
if let Some(attendee) = self.attendees.iter_mut().find(|a| a.contact_id == contact_id) {
|
|
||||||
attendee.status = status;
|
|
||||||
}
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,14 +163,11 @@ impl Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a calendar with events
|
/// Represents a calendar with events
|
||||||
#[rhai_model_export(
|
#[rhai_model_export(db_type = "std::sync::Arc<crate::db::hero::OurDB>")]
|
||||||
db_type = "std::sync::Arc<crate::db::hero::OurDB>",
|
|
||||||
)]
|
|
||||||
#[model]
|
#[model]
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType)]
|
||||||
pub struct Calendar {
|
pub struct Calendar {
|
||||||
/// Base model data
|
/// Base model data
|
||||||
#[serde(flatten)]
|
|
||||||
pub base_data: BaseModelData,
|
pub base_data: BaseModelData,
|
||||||
|
|
||||||
/// Name of the calendar
|
/// Name of the calendar
|
||||||
@ -194,7 +224,8 @@ impl Calendar {
|
|||||||
|
|
||||||
/// Removes an event from the calendar by its ID
|
/// Removes an event from the calendar by its ID
|
||||||
pub fn remove_event(mut self, event_id_to_remove: i64) -> Self {
|
pub fn remove_event(mut self, event_id_to_remove: i64) -> Self {
|
||||||
self.events.retain(|&event_id_in_vec| event_id_in_vec != event_id_to_remove);
|
self.events
|
||||||
|
.retain(|&event_id_in_vec| event_id_in_vec != event_id_to_remove);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
use rhai::{Engine, EvalAltResult, NativeCallContext, ImmutableString};
|
use rhai::{Engine, EvalAltResult, ImmutableString, NativeCallContext};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use heromodels_core::BaseModelData;
|
use super::calendar::{AttendanceStatus, Attendee, Calendar, Event};
|
||||||
use crate::db::hero::OurDB;
|
use crate::db::hero::OurDB;
|
||||||
use super::calendar::{Calendar, Event, Attendee, AttendanceStatus};
|
|
||||||
use adapter_macros::{adapt_rhai_i64_input_fn, adapt_rhai_i64_input_method};
|
|
||||||
use adapter_macros::rhai_timestamp_helpers;
|
use adapter_macros::rhai_timestamp_helpers;
|
||||||
|
use adapter_macros::{adapt_rhai_i64_input_fn, adapt_rhai_i64_input_method};
|
||||||
|
use heromodels_core::BaseModelData;
|
||||||
|
|
||||||
// Helper function for get_all_calendars registration
|
// Helper function for get_all_calendars registration
|
||||||
|
|
||||||
|
|
||||||
fn new_calendar_rhai(name: String) -> Result<Calendar, Box<EvalAltResult>> {
|
fn new_calendar_rhai(name: String) -> Result<Calendar, Box<EvalAltResult>> {
|
||||||
Ok(Calendar::new(None, name))
|
Ok(Calendar::new(None, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_event_rhai(
|
fn new_event_rhai(
|
||||||
@ -20,71 +19,113 @@ fn new_event_rhai(
|
|||||||
start_time_ts: i64,
|
start_time_ts: i64,
|
||||||
end_time_ts: i64,
|
end_time_ts: i64,
|
||||||
) -> Result<Event, Box<EvalAltResult>> {
|
) -> Result<Event, Box<EvalAltResult>> {
|
||||||
let start_time = rhai_timestamp_helpers::rhai_timestamp_to_datetime(start_time_ts)
|
let start_time =
|
||||||
.map_err(|e_str| Box::new(EvalAltResult::ErrorRuntime(
|
rhai_timestamp_helpers::rhai_timestamp_to_datetime(start_time_ts).map_err(|e_str| {
|
||||||
format!("Failed to convert start_time for Event: {}", e_str).into(),
|
Box::new(EvalAltResult::ErrorRuntime(
|
||||||
context.position(),
|
format!("Failed to convert start_time for Event: {}", e_str).into(),
|
||||||
)))?;
|
|
||||||
|
|
||||||
let end_time = rhai_timestamp_helpers::rhai_timestamp_to_datetime(end_time_ts)
|
|
||||||
.map_err(|e_str| Box::new(EvalAltResult::ErrorRuntime(
|
|
||||||
format!("Failed to convert end_time for Event: {}", e_str).into(),
|
|
||||||
context.position(),
|
|
||||||
)))?;
|
|
||||||
|
|
||||||
Ok(Event::new(title_rhai.to_string(), start_time, end_time))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn register_rhai_engine_functions(engine: &mut Engine, db: Arc<OurDB>) {
|
|
||||||
engine.register_fn("name", move |calendar: Calendar, name: String| Calendar::name(calendar, name));
|
|
||||||
engine.register_fn("description", move |calendar: Calendar, description: String| Calendar::description(calendar, description));
|
|
||||||
engine.register_fn("add_event", Calendar::add_event);
|
|
||||||
// Note: Event IDs are i64 in Calendar.events, but Event model's base_data.id is u32.
|
|
||||||
// This might require adjustment if events are fetched by ID from the DB via Calendar.events.
|
|
||||||
|
|
||||||
engine.register_fn("new_event", |context: NativeCallContext, title_rhai: ImmutableString, start_time_ts: i64, end_time_ts: i64| -> Result<Event, Box<EvalAltResult>> {
|
|
||||||
new_event_rhai(context, title_rhai, start_time_ts, end_time_ts)
|
|
||||||
});
|
|
||||||
engine.register_fn("title", move |event: Event, title: String| Event::title(event, title));
|
|
||||||
engine.register_fn("description", move |event: Event, description: String| Event::description(event, description));
|
|
||||||
engine.register_fn("add_attendee", move |event: Event, attendee: Attendee| Event::add_attendee(event, attendee));
|
|
||||||
engine.register_fn("remove_attendee", adapt_rhai_i64_input_method!(Event, remove_attendee, u32));
|
|
||||||
engine.register_fn("update_attendee_status", move |context: NativeCallContext, event: Event, contact_id_i64: i64, status: AttendanceStatus| -> Result<Event, Box<EvalAltResult>> {
|
|
||||||
let contact_id_u32: u32 = contact_id_i64.try_into().map_err(|_e| {
|
|
||||||
Box::new(EvalAltResult::ErrorArithmetic(
|
|
||||||
format!("Conversion error for contact_id in Event::update_attendee_status from i64 to u32"),
|
|
||||||
context.position(),
|
context.position(),
|
||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
Ok(event.update_attendee_status(contact_id_u32, status))
|
|
||||||
|
let end_time =
|
||||||
|
rhai_timestamp_helpers::rhai_timestamp_to_datetime(end_time_ts).map_err(|e_str| {
|
||||||
|
Box::new(EvalAltResult::ErrorRuntime(
|
||||||
|
format!("Failed to convert end_time for Event: {}", e_str).into(),
|
||||||
|
context.position(),
|
||||||
|
))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Ok(Event::new(title_rhai.to_string(), start_time, end_time))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn register_rhai_engine_functions(engine: &mut Engine, db: Arc<OurDB>) {
|
||||||
|
engine.register_fn("name", move |calendar: Calendar, name: String| {
|
||||||
|
Calendar::name(calendar, name)
|
||||||
});
|
});
|
||||||
|
engine.register_fn(
|
||||||
|
"description",
|
||||||
|
move |calendar: Calendar, description: String| Calendar::description(calendar, description),
|
||||||
|
);
|
||||||
|
engine.register_fn("add_event", Calendar::add_event);
|
||||||
|
// Note: Event IDs are i64 in Calendar.events, but Event model's base_data.id is u32.
|
||||||
|
// This might require adjustment if events are fetched by ID from the DB via Calendar.events.
|
||||||
|
|
||||||
|
engine.register_fn(
|
||||||
|
"new_event",
|
||||||
|
|context: NativeCallContext,
|
||||||
|
title_rhai: ImmutableString,
|
||||||
|
start_time_ts: i64,
|
||||||
|
end_time_ts: i64|
|
||||||
|
-> Result<Event, Box<EvalAltResult>> {
|
||||||
|
new_event_rhai(context, title_rhai, start_time_ts, end_time_ts)
|
||||||
|
},
|
||||||
|
);
|
||||||
|
engine.register_fn("title", move |event: Event, title: String| {
|
||||||
|
Event::title(event, title)
|
||||||
|
});
|
||||||
|
engine.register_fn("description", move |event: Event, description: String| {
|
||||||
|
Event::description(event, description)
|
||||||
|
});
|
||||||
|
engine.register_fn(
|
||||||
|
"add_attendee",
|
||||||
|
adapt_rhai_i64_input_method!(Event, add_attendee, u32),
|
||||||
|
);
|
||||||
|
engine.register_fn(
|
||||||
|
"remove_attendee",
|
||||||
|
adapt_rhai_i64_input_method!(Event, remove_attendee, u32),
|
||||||
|
);
|
||||||
|
|
||||||
engine.register_fn("new_attendee", adapt_rhai_i64_input_fn!(Attendee::new, u32));
|
engine.register_fn("new_attendee", adapt_rhai_i64_input_fn!(Attendee::new, u32));
|
||||||
|
|
||||||
engine.register_fn("new_calendar", |name: String| -> Result<Calendar, Box<EvalAltResult>> { new_calendar_rhai(name) });
|
engine.register_fn(
|
||||||
|
"new_calendar",
|
||||||
|
|name: String| -> Result<Calendar, Box<EvalAltResult>> { new_calendar_rhai(name) },
|
||||||
|
);
|
||||||
|
|
||||||
// Register a function to get the database instance
|
// Register a function to get the database instance
|
||||||
engine.register_fn("get_db", move || db.clone());
|
engine.register_fn("get_db", move || db.clone());
|
||||||
|
|
||||||
// Register getters for Calendar
|
// Register getters for Calendar
|
||||||
engine.register_get("id", |c: &mut Calendar| -> Result<i64, Box<EvalAltResult>> { Ok(c.base_data.id as i64) });
|
engine.register_get(
|
||||||
engine.register_get("name", |c: &mut Calendar| -> Result<String, Box<EvalAltResult>> {
|
"id",
|
||||||
// println!("Rhai attempting to get Calendar.name: {}", c.name); // Debug print
|
|c: &mut Calendar| -> Result<i64, Box<EvalAltResult>> { Ok(c.base_data.id as i64) },
|
||||||
Ok(c.name.clone())
|
);
|
||||||
});
|
engine.register_get(
|
||||||
engine.register_get("description", |c: &mut Calendar| -> Result<Option<String>, Box<EvalAltResult>> { Ok(c.description.clone()) });
|
"name",
|
||||||
|
|c: &mut Calendar| -> Result<String, Box<EvalAltResult>> {
|
||||||
|
// println!("Rhai attempting to get Calendar.name: {}", c.name); // Debug print
|
||||||
|
Ok(c.name.clone())
|
||||||
|
},
|
||||||
|
);
|
||||||
|
engine.register_get(
|
||||||
|
"description",
|
||||||
|
|c: &mut Calendar| -> Result<Option<String>, Box<EvalAltResult>> {
|
||||||
|
Ok(c.description.clone())
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Register getter for Calendar.base_data
|
// Register getter for Calendar.base_data
|
||||||
engine.register_get("base_data", |c: &mut Calendar| -> Result<BaseModelData, Box<EvalAltResult>> { Ok(c.base_data.clone()) });
|
engine.register_get(
|
||||||
|
"base_data",
|
||||||
|
|c: &mut Calendar| -> Result<BaseModelData, Box<EvalAltResult>> { Ok(c.base_data.clone()) },
|
||||||
|
);
|
||||||
|
|
||||||
// Register getters for BaseModelData
|
// Register getters for BaseModelData
|
||||||
engine.register_get("id", |bmd: &mut BaseModelData| -> Result<i64, Box<EvalAltResult>> { Ok(bmd.id.into()) });
|
engine.register_get(
|
||||||
|
"id",
|
||||||
|
|bmd: &mut BaseModelData| -> Result<i64, Box<EvalAltResult>> { Ok(bmd.id.into()) },
|
||||||
|
);
|
||||||
|
|
||||||
// Database interaction functions for Calendar are expected to be provided by #[rhai_model_export(..)] on the Calendar struct.
|
// Database interaction functions for Calendar are expected to be provided by #[rhai_model_export(..)] on the Calendar struct.
|
||||||
// Ensure that `db.rs` or similar correctly wires up the `OurDB` methods for these.
|
// Ensure that `db.rs` or similar correctly wires up the `OurDB` methods for these.
|
||||||
|
|
||||||
// Getters for Event
|
// Getters for Event
|
||||||
engine.register_get("id", |e: &mut Event| -> Result<i64, Box<EvalAltResult>> { Ok(e.base_data.id as i64) });
|
engine.register_get("id", |e: &mut Event| -> Result<i64, Box<EvalAltResult>> {
|
||||||
engine.register_get("title", |e: &mut Event| -> Result<String, Box<EvalAltResult>> { Ok(e.title.clone()) });
|
Ok(e.base_data.id as i64)
|
||||||
|
});
|
||||||
|
engine.register_get(
|
||||||
|
"title",
|
||||||
|
|e: &mut Event| -> Result<String, Box<EvalAltResult>> { Ok(e.title.clone()) },
|
||||||
|
);
|
||||||
// Add more getters for Event fields as needed
|
// Add more getters for Event fields as needed
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user