Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Dec 1, 2023
1 parent 24cb9f9 commit 23fde50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ee/tabby-webserver/src/service/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
5 changes: 4 additions & 1 deletion ee/tabby-webserver/src/service/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ impl DbConn {
Ok(invitations)
}

pub async fn get_invitation_by_code(&self, code: String) -> Result<Option<Invitation>> {
pub async fn get_invitation_by_code(&self, code: &str) -> Result<Option<Invitation>> {
let code = code.to_owned();
let token = self
.conn
.call(|conn| {
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 23fde50

Please sign in to comment.