mirror of
https://github.com/CloudNebulaProject/barycenter.git
synced 2026-04-10 13:10:42 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
f6262b2128
commit
210a27ca02
3 changed files with 3 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ pub struct Model {
|
||||||
pub created_at: i64,
|
pub created_at: i64,
|
||||||
pub expires_at: i64,
|
pub expires_at: i64,
|
||||||
pub last_poll_at: Option<i64>,
|
pub last_poll_at: Option<i64>,
|
||||||
pub interval: i64,
|
pub interval: i32,
|
||||||
pub status: String, // "pending" | "approved" | "denied" | "consumed"
|
pub status: String, // "pending" | "approved" | "denied" | "consumed"
|
||||||
pub subject: Option<String>,
|
pub subject: Option<String>,
|
||||||
pub auth_time: Option<i64>,
|
pub auth_time: Option<i64>,
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ pub struct DeviceCode {
|
||||||
pub created_at: i64,
|
pub created_at: i64,
|
||||||
pub expires_at: i64,
|
pub expires_at: i64,
|
||||||
pub last_poll_at: Option<i64>,
|
pub last_poll_at: Option<i64>,
|
||||||
pub interval: i64,
|
pub interval: i32,
|
||||||
pub status: String, // "pending" | "approved" | "denied" | "consumed"
|
pub status: String, // "pending" | "approved" | "denied" | "consumed"
|
||||||
pub subject: Option<String>,
|
pub subject: Option<String>,
|
||||||
pub auth_time: Option<i64>,
|
pub auth_time: Option<i64>,
|
||||||
|
|
|
||||||
|
|
@ -1695,7 +1695,7 @@ async fn handle_device_code_grant(
|
||||||
let now = chrono::Utc::now().timestamp();
|
let now = chrono::Utc::now().timestamp();
|
||||||
let elapsed = now - last_poll;
|
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
|
// Polling too fast - increment interval and return slow_down
|
||||||
let _ = storage::increment_device_code_interval(&state.db, &device_code_str).await;
|
let _ = storage::increment_device_code_interval(&state.db, &device_code_str).await;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue