barycenter/src/entities/device_code.rs
Till Wegmueller 210a27ca02
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>
2026-02-22 18:33:50 +01:00

28 lines
958 B
Rust

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "device_codes")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub device_code: String,
pub user_code: String,
pub client_id: String,
pub client_name: Option<String>,
pub scope: String,
pub device_info: Option<String>, // JSON: {ip_address, user_agent}
pub created_at: i64,
pub expires_at: i64,
pub last_poll_at: Option<i64>,
pub interval: i32,
pub status: String, // "pending" | "approved" | "denied" | "consumed"
pub subject: Option<String>,
pub auth_time: Option<i64>,
pub amr: Option<String>, // JSON array: ["pwd", "hwk"]
pub acr: Option<String>, // "aal1" or "aal2"
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}