summaryrefslogtreecommitdiff
path: root/src/repository
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-03-16 14:19:42 +0100
committerGitHub <noreply@github.com>2021-03-16 14:19:42 +0100
commit896ab2a9fb4a34d82c70792a1114ac1a0f4ad6c0 (patch)
tree6884cfe0cb85ffee94095d1e9db3864476c24de4 /src/repository
parentb950072a3109d2c13881611a3950baa191caf097 (diff)
parentfc28f445d4cfbfcd597438ab2cdd137fa2021dbc (diff)
Merge pull request #13 from gico-net/feat/add-emails
Manage emails and their hashes for Gravatar
Diffstat (limited to 'src/repository')
-rw-r--r--src/repository/models.rs7
-rw-r--r--src/repository/routes.rs1
2 files changed, 3 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),
diff --git a/src/repository/routes.rs b/src/repository/routes.rs
index a0f4db5..abf77b6 100644
--- a/src/repository/routes.rs
+++ b/src/repository/routes.rs
@@ -80,6 +80,7 @@ async fn delete_repo(
.map_err(|e| e)
}
+/// Endpoint used for create new repository
async fn create_repo(
req: HttpRequest,
payload: web::Json<RepositoryData>,