diff options
-rw-r--r-- | src/repository/models.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/repository/models.rs b/src/repository/models.rs index 1cbf3bb..e3d8456 100644 --- a/src/repository/models.rs +++ b/src/repository/models.rs @@ -180,12 +180,9 @@ impl Repository { }; let repo = client - .query(&statement, &[&uuid, &repo_name, &user_ip]) + .query_opt(&statement, &[&uuid, &repo_name, &user_ip]) .await? - .iter() - .map(|row| Repository::from_row_ref(row).unwrap()) - .collect::<Vec<Repository>>() - .pop(); + .map(|row| Repository::from_row_ref(&row).unwrap()); match repo { Some(repo) => Ok(repo), |