Register endpoint #16
@@ -53,13 +53,13 @@ pub async fn register_user(
|
||||
match repo::user::exists(&pool, &user.username).await {
|
||||
Ok(res) => {
|
||||
if res {
|
||||
return (
|
||||
(
|
||||
StatusCode::NOT_FOUND,
|
||||
Json(response::Response {
|
||||
message: String::from("Error"),
|
||||
data: vec![user],
|
||||
}),
|
||||
);
|
||||
)
|
||||
} else {
|
||||
match repo::user::insert(&pool, &user).await {
|
||||
Ok(id) => {
|
||||
|
@@ -13,7 +13,7 @@ pub mod user {
|
||||
SELECT 1 FROM "user" WHERE username = $1
|
||||
"#,
|
||||
)
|
||||
.bind(&username)
|
||||
.bind(username)
|
||||
.fetch_optional(pool)
|
||||
.await;
|
||||
|
||||
|
Reference in New Issue
Block a user