From a6dffedb3fcc2ade8eba0a086d219bf9acd98859 Mon Sep 17 00:00:00 2001 From: yorunoken Date: Thu, 15 Jan 2026 21:59:45 +0300 Subject: [PATCH 1/3] get rid of redundant renames --- src/models/profile.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/models/profile.rs b/src/models/profile.rs index fa01f58..e5db6f5 100644 --- a/src/models/profile.rs +++ b/src/models/profile.rs @@ -45,7 +45,6 @@ pub struct ProfileSet { pub units: String, #[napi(js_name = "createdAt")] - #[serde(rename = "created_at")] pub created_at: String, } @@ -53,7 +52,6 @@ pub struct ProfileSet { #[napi(object)] pub struct ProfileConfig { pub dia: f64, - #[serde(rename = "carbs_hr")] pub carbs_hr: f64, pub delay: f64, pub timezone: String, @@ -61,9 +59,7 @@ pub struct ProfileConfig { pub carbratio: Vec, pub sens: Vec, pub basal: Vec, - #[serde(rename = "target_low")] pub target_low: Vec, - #[serde(rename = "target_high")] pub target_high: Vec, } From 43e26c4d4ced3ea83bc10f1f6267d9ba9bd03857 Mon Sep 17 00:00:00 2001 From: yorunoken Date: Thu, 15 Jan 2026 22:00:53 +0300 Subject: [PATCH 2/3] update values that can be null to `Option` --- src/models/profile.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models/profile.rs b/src/models/profile.rs index e5db6f5..1a85fde 100644 --- a/src/models/profile.rs +++ b/src/models/profile.rs @@ -40,9 +40,9 @@ pub struct ProfileSet { pub store: HashMap, #[serde(rename = "mills")] - pub mills: i64, + pub mills: Option, - pub units: String, + pub units: Option, #[napi(js_name = "createdAt")] pub created_at: String, @@ -52,8 +52,8 @@ pub struct ProfileSet { #[napi(object)] pub struct ProfileConfig { pub dia: f64, - pub carbs_hr: f64, - pub delay: f64, + pub carbs_hr: Option, + pub delay: Option, pub timezone: String, pub units: String, pub carbratio: Vec, From 466a23ba4dd64d16c74874d018452c91b185d85b Mon Sep 17 00:00:00 2001 From: yorunoken Date: Fri, 16 Jan 2026 21:32:59 +0300 Subject: [PATCH 3/3] skip serialization on nullable values --- src/models/profile.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/models/profile.rs b/src/models/profile.rs index 1a85fde..f61a2de 100644 --- a/src/models/profile.rs +++ b/src/models/profile.rs @@ -40,8 +40,10 @@ pub struct ProfileSet { pub store: HashMap, #[serde(rename = "mills")] + #[serde(skip_serializing_if = "Option::is_none")] pub mills: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub units: Option, #[napi(js_name = "createdAt")] @@ -52,7 +54,9 @@ pub struct ProfileSet { #[napi(object)] pub struct ProfileConfig { pub dia: f64, + #[serde(skip_serializing_if = "Option::is_none")] pub carbs_hr: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub delay: Option, pub timezone: String, pub units: String,