From a18c0431d134d816ae316b9124d283e1aa52cb16 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sat, 28 Feb 2026 08:07:03 -0600 Subject: [PATCH] Fix sync JSON parse error: Discord snowflake IDs are strings, not i64 The API returns gmid/gmid2 as quoted strings ("258104532423147520") to avoid JavaScript precision loss. Changed types to Option. Co-Authored-By: Claude Opus 4.6 --- rust/src/api/sync.rs | 4 ++-- rust/src/api/types.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/src/api/sync.rs b/rust/src/api/sync.rs index a71d595..9230e29 100644 --- a/rust/src/api/sync.rs +++ b/rust/src/api/sync.rs @@ -22,8 +22,8 @@ pub async fn sync_teams(pool: &SqlitePool, season: i64, client: &LeagueApiClient for data in response.teams { let manager1_name = data.manager1.and_then(|m| m.name); let manager2_name = data.manager2.and_then(|m| m.name); - let gm_discord_id = data.gm_discord_id.map(|id| id.to_string()); - let gm2_discord_id = data.gm2_discord_id.map(|id| id.to_string()); + let gm_discord_id = data.gm_discord_id; + let gm2_discord_id = data.gm2_discord_id; let division_id = data.division.as_ref().map(|d| d.id).flatten(); let division_name = data.division.as_ref().and_then(|d| d.division_name.clone()); let league_abbrev = data.division.as_ref().and_then(|d| d.league_abbrev.clone()); diff --git a/rust/src/api/types.rs b/rust/src/api/types.rs index 43db060..ac86422 100644 --- a/rust/src/api/types.rs +++ b/rust/src/api/types.rs @@ -59,12 +59,12 @@ pub struct TeamData { pub stadium: Option, #[serde(default)] pub salary_cap: Option, - /// Discord user ID of the primary GM (API sends integer, DB stores as String). + /// Discord user ID of the primary GM (API sends as string). #[serde(rename = "gmid", default)] - pub gm_discord_id: Option, - /// Discord user ID of the secondary GM (API sends integer, DB stores as String). + pub gm_discord_id: Option, + /// Discord user ID of the secondary GM (API sends as string). #[serde(rename = "gmid2", default)] - pub gm2_discord_id: Option, + pub gm2_discord_id: Option, #[serde(default)] pub manager1: Option, #[serde(default)]