use crate::secrets::Secret;
#[cfg(feature = "storage-seaorm")]
use sea_orm::{ActiveValue, entity::prelude::*};
#[cfg(feature = "storage-seaorm-v2")]
use sea_orm_v2::{self as sea_orm, ActiveValue, entity::prelude::*};
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "axum_gate_credentials")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
#[sea_orm(unique)]
pub account_id: Uuid,
pub secret: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}
impl From<Secret> for ActiveModel {
fn from(value: Secret) -> Self {
Self {
id: ActiveValue::NotSet,
account_id: ActiveValue::Set(value.account_id),
secret: ActiveValue::Set(value.secret),
}
}
}