Register endpoint #16

Merged
phoenix merged 56 commits from register_endpoint-init into devel 2025-04-05 19:26:59 +00:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit f6f2370fee - Show all commits

View File

@@ -53,13 +53,13 @@ pub async fn register_user(
match repo::user::exists(&pool, &user.username).await { match repo::user::exists(&pool, &user.username).await {
Ok(res) => { Ok(res) => {
if res { if res {
return ( (
StatusCode::NOT_FOUND, StatusCode::NOT_FOUND,
Json(response::Response { Json(response::Response {
message: String::from("Error"), message: String::from("Error"),
data: vec![user], data: vec![user],
}), }),
); )
} else { } else {
match repo::user::insert(&pool, &user).await { match repo::user::insert(&pool, &user).await {
Ok(id) => { Ok(id) => {

View File

@@ -13,7 +13,7 @@ pub mod user {
SELECT 1 FROM "user" WHERE username = $1 SELECT 1 FROM "user" WHERE username = $1
"#, "#,
) )
.bind(&username) .bind(username)
.fetch_optional(pool) .fetch_optional(pool)
.await; .await;