From 210a27ca0258a65d2042f4b94bfa5917ce0b664a Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Sun, 22 Feb 2026 18:33:50 +0100 Subject: [PATCH] fix: Change device_code interval from i64 to i32 The migration creates the interval column as integer (INT4) but the entity and storage struct used i64 (INT8), causing a type mismatch error on PostgreSQL. Co-Authored-By: Claude Opus 4.6 --- src/entities/device_code.rs | 2 +- src/storage.rs | 2 +- src/web.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/entities/device_code.rs b/src/entities/device_code.rs index beb93a9..29800a8 100644 --- a/src/entities/device_code.rs +++ b/src/entities/device_code.rs @@ -14,7 +14,7 @@ pub struct Model { pub created_at: i64, pub expires_at: i64, pub last_poll_at: Option, - pub interval: i64, + pub interval: i32, pub status: String, // "pending" | "approved" | "denied" | "consumed" pub subject: Option, pub auth_time: Option, diff --git a/src/storage.rs b/src/storage.rs index 858cad2..aafe7d9 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -103,7 +103,7 @@ pub struct DeviceCode { pub created_at: i64, pub expires_at: i64, pub last_poll_at: Option, - pub interval: i64, + pub interval: i32, pub status: String, // "pending" | "approved" | "denied" | "consumed" pub subject: Option, pub auth_time: Option, diff --git a/src/web.rs b/src/web.rs index fdc46a9..d17ed1e 100644 --- a/src/web.rs +++ b/src/web.rs @@ -1695,7 +1695,7 @@ async fn handle_device_code_grant( let now = chrono::Utc::now().timestamp(); let elapsed = now - last_poll; - if elapsed < device_code.interval { + if elapsed < device_code.interval as i64 { // Polling too fast - increment interval and return slow_down let _ = storage::increment_device_code_interval(&state.db, &device_code_str).await;