From cadefe3f1db57ee8492af2a45effe7eb91114029 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 20 Nov 2024 09:54:01 +0200 Subject: [PATCH] fix unique key for auth --- src/profile/identity/gemini.rs | 2 +- src/profile/identity/gemini/auth.rs | 2 +- src/profile/identity/gemini/auth/database.rs | 6 +----- src/profile/identity/gemini/auth/error.rs | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/profile/identity/gemini.rs b/src/profile/identity/gemini.rs index e0e04cd4..18b152f2 100644 --- a/src/profile/identity/gemini.rs +++ b/src/profile/identity/gemini.rs @@ -34,7 +34,7 @@ impl Gemini { // Init components let auth = match Auth::new(connection.clone()) { Ok(auth) => Rc::new(auth), - Err(reason) => return Err(Error::AuthInit(reason)), // @TODO + Err(reason) => return Err(Error::AuthInit(reason)), }; let database = Rc::new(Database::new(connection, profile_identity_id.clone())); let memory = Rc::new(Memory::new()); diff --git a/src/profile/identity/gemini/auth.rs b/src/profile/identity/gemini/auth.rs index 61891b14..516b3dbc 100644 --- a/src/profile/identity/gemini/auth.rs +++ b/src/profile/identity/gemini/auth.rs @@ -89,7 +89,7 @@ impl Auth { .memory .add(record.url, record.profile_identity_gemini_id) { - return Err(Error::Memory(reason)); + return Err(Error::MemoryIndex(reason)); } } } diff --git a/src/profile/identity/gemini/auth/database.rs b/src/profile/identity/gemini/auth/database.rs index 2455ac13..96428eed 100644 --- a/src/profile/identity/gemini/auth/database.rs +++ b/src/profile/identity/gemini/auth/database.rs @@ -78,11 +78,7 @@ pub fn init(tx: &Transaction) -> Result { `url` VARCHAR(1024) NOT NULL, FOREIGN KEY (`profile_identity_gemini_id`) REFERENCES `profile_identity_gemini`(`id`), - - UNIQUE ( - `profile_identity_gemini_id`, - `url` - ) + UNIQUE (`url`) )", [], ) diff --git a/src/profile/identity/gemini/auth/error.rs b/src/profile/identity/gemini/auth/error.rs index 3b510002..e6b53eec 100644 --- a/src/profile/identity/gemini/auth/error.rs +++ b/src/profile/identity/gemini/auth/error.rs @@ -4,5 +4,5 @@ pub enum Error { DatabaseRecordCreate(i64, String), DatabaseRecordDelete(i64), DatabaseRecordsRead(String), - Memory(super::memory::Error), + MemoryIndex(super::memory::Error), }