diff --git a/backend/src/payloads.rs b/backend/src/payloads.rs index 3a44398..3f9de74 100644 --- a/backend/src/payloads.rs +++ b/backend/src/payloads.rs @@ -8,7 +8,7 @@ pub type ApiResult = Result, ApiError>; #[derive(Deserialize)] pub struct EventInput { - pub name: String, + pub name: Option, pub times: Vec, pub timezone: String, } diff --git a/backend/src/routes/create_event.rs b/backend/src/routes/create_event.rs index 74bc66f..9e0d6f8 100644 --- a/backend/src/routes/create_event.rs +++ b/backend/src/routes/create_event.rs @@ -19,9 +19,9 @@ pub async fn create_event( let now = chrono::offset::Utc::now(); // Generate a name if none provided - let name = match input.name.trim() { - "" => generate_name(), - x => x.to_string(), + let name = match input.name { + Some(x) if !x.is_empty() => x.trim().to_string(), + _ => generate_name(), }; // Generate an ID