From 371e93f0a766031340c581ab2da33c8751fbe58b Mon Sep 17 00:00:00 2001 From: Dmitrii Baranov Date: Sun, 11 Aug 2024 11:10:11 +0300 Subject: [PATCH] Exclude deleted user when querying database --- assets/db/queries/bot_user/get_all_bot_users_for_chat.sql | 3 ++- assets/db/queries/bot_user/get_single_user_for_chat.sql | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/db/queries/bot_user/get_all_bot_users_for_chat.sql b/assets/db/queries/bot_user/get_all_bot_users_for_chat.sql index 0e56d8d..14011b8 100644 --- a/assets/db/queries/bot_user/get_all_bot_users_for_chat.sql +++ b/assets/db/queries/bot_user/get_all_bot_users_for_chat.sql @@ -1,4 +1,5 @@ SELECT id, name, is_premium, deleted, banned, moderator FROM bot_user INNER JOIN chat_member cm ON bot_user.id = cm.bot_user_id -WHERE chat_id = @chatId; +WHERE chat_id = @chatId + AND deleted = false; diff --git a/assets/db/queries/bot_user/get_single_user_for_chat.sql b/assets/db/queries/bot_user/get_single_user_for_chat.sql index fb172ea..7cf55a0 100644 --- a/assets/db/queries/bot_user/get_single_user_for_chat.sql +++ b/assets/db/queries/bot_user/get_single_user_for_chat.sql @@ -2,4 +2,5 @@ SELECT id, name, is_premium, deleted, banned, moderator FROM bot_user INNER JOIN chat_member cm ON bot_user.id = cm.bot_user_id WHERE chat_id = @chatId - AND bot_user.id = @userId; + AND bot_user.id = @userId + AND deleted = false;