merge branches and cleanup db

This commit is contained in:
timurgordon
2025-06-27 12:11:04 +03:00
parent 5563d7e27e
commit 1f9ec01934
177 changed files with 1202 additions and 174 deletions

View File

@@ -1,12 +1,12 @@
use heromodels_core::BaseModelData;
use heromodels_derive::model;
use rhai::{CustomType, TypeBuilder};
use rhai_autobind_macros::rhai_model_export;
use serde::{Deserialize, Serialize};
/// Represents the status of an attendee for an event
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum AttendanceStatus {
#[default]
Accepted = 0,
Declined = 1,
Tentative = 2,
@@ -14,8 +14,9 @@ pub enum AttendanceStatus {
}
/// Represents the status of an event
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum EventStatus {
#[default]
Draft = 0,
Published = 1,
Cancelled = 2,
@@ -87,7 +88,7 @@ impl Attendee {
/// Represents an event in a calendar
#[model]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType, Default)]
pub struct Event {
/// Base model data
pub base_data: BaseModelData,
@@ -224,10 +225,14 @@ impl Event {
}
/// Adds an attendee ID to the event
pub fn add_attendee(mut self, attendee_id: u32) -> Self {
pub fn add_attendee(mut self, attendee: Attendee) -> Self {
// Prevent duplicate attendees by ID
if !self.attendees.iter().any(|&a_id| a_id == attendee_id) {
self.attendees.push(attendee_id);
if !self
.attendees
.iter()
.any(|a| a.contact_id == attendee.contact_id)
{
self.attendees.push(attendee);
}
self
}