From 23fde50a16369ae0bd2018722b63e98765dda524 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Fri, 1 Dec 2023 22:57:01 +0800 Subject: [PATCH] test --- ee/tabby-webserver/src/service/auth.rs | 2 +- ee/tabby-webserver/src/service/db.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ee/tabby-webserver/src/service/auth.rs b/ee/tabby-webserver/src/service/auth.rs index 612158ab63d0..5597769d095e 100644 --- a/ee/tabby-webserver/src/service/auth.rs +++ b/ee/tabby-webserver/src/service/auth.rs @@ -133,7 +133,7 @@ impl AuthenticationService for DbConn { return err; }; - let Some(invitation) = self.get_invitation_by_code(invitation_code).await? else { + let Some(invitation) = self.get_invitation_by_code(&invitation_code).await? else { return err; }; diff --git a/ee/tabby-webserver/src/service/db.rs b/ee/tabby-webserver/src/service/db.rs index 42543cd520fc..0b027ff869bc 100644 --- a/ee/tabby-webserver/src/service/db.rs +++ b/ee/tabby-webserver/src/service/db.rs @@ -249,7 +249,8 @@ impl DbConn { Ok(invitations) } - pub async fn get_invitation_by_code(&self, code: String) -> Result> { + pub async fn get_invitation_by_code(&self, code: &str) -> Result> { + let code = code.to_owned(); let token = self .conn .call(|conn| { @@ -378,6 +379,8 @@ mod tests { assert_eq!(1, invitations.len()); assert!(Uuid::parse_str(&invitations[0].code).is_ok()); + let invitation = conn.get_invitation_by_code(&invitations[0].code).await.ok().flatten().unwrap(); + assert_eq!(invitation.id, invitations[0].id); conn.delete_invitation(invitations[0].id).await.unwrap();