From 3a469d5d7ce0b59c61ff8f69bf7e677b982d35a5 Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:20:50 +0200 Subject: [PATCH] fix sql errors --- src/db/chat.rs | 2 +- src/db/user.rs | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/db/chat.rs b/src/db/chat.rs index 7f67a93..9443022 100644 --- a/src/db/chat.rs +++ b/src/db/chat.rs @@ -11,7 +11,7 @@ pub async fn create_chat(db: &DbPool, chat: &types::Chat) -> Result Result { +pub async fn create_user(db: &DbPool, user: &types::User) -> Result { sqlx::query( r#"INSERT OR IGNORE INTO "user" (tg_id, username, first_name, last_name, can_download, is_admin, has_private_chat) @@ -18,8 +13,8 @@ pub async fn create_user( .bind(&user.username) .bind(&user.first_name) .bind(&user.last_name) - .bind(can_download as i64) - .bind(is_admin as i64) + .bind(false) + .bind(false) .bind(0) .execute(db) .await?; @@ -38,5 +33,5 @@ pub async fn find_or_create_user(db: &DbPool, user: &types::User) -> Result