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<String>.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bf7c3f870f
commit
a18c0431d1
@ -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());
|
||||
|
||||
@ -59,12 +59,12 @@ pub struct TeamData {
|
||||
pub stadium: Option<String>,
|
||||
#[serde(default)]
|
||||
pub salary_cap: Option<f64>,
|
||||
/// 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<i64>,
|
||||
/// Discord user ID of the secondary GM (API sends integer, DB stores as String).
|
||||
pub gm_discord_id: Option<String>,
|
||||
/// Discord user ID of the secondary GM (API sends as string).
|
||||
#[serde(rename = "gmid2", default)]
|
||||
pub gm2_discord_id: Option<i64>,
|
||||
pub gm2_discord_id: Option<String>,
|
||||
#[serde(default)]
|
||||
pub manager1: Option<Manager>,
|
||||
#[serde(default)]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user