From 86a0d6160eff8374048f8ab5b6b3e38f60b06a58 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Mon, 30 Dec 2024 22:03:23 +0100 Subject: [PATCH] add two_factor_id --- src/db/models/two_factor.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/db/models/two_factor.rs b/src/db/models/two_factor.rs index 0df69869c51..0f5a5de590b 100644 --- a/src/db/models/two_factor.rs +++ b/src/db/models/two_factor.rs @@ -8,7 +8,7 @@ db_object! { #[diesel(table_name = twofactor)] #[diesel(primary_key(uuid))] pub struct TwoFactor { - pub uuid: String, + pub uuid: TwoFactorId, pub user_uuid: UserId, pub atype: i32, pub enabled: bool, @@ -44,7 +44,7 @@ pub enum TwoFactorType { impl TwoFactor { pub fn new(user_uuid: UserId, atype: TwoFactorType, data: String) -> Self { Self { - uuid: crate::util::get_uuid(), + uuid: TwoFactorId(crate::util::get_uuid()), user_uuid, atype: atype as i32, enabled: true, @@ -218,3 +218,6 @@ impl TwoFactor { Ok(()) } } + +#[derive(Clone, Debug, DieselNewType, FromForm, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct TwoFactorId(String);