Work on download files(private chats and groups)

This commit is contained in:
2025-08-14 19:48:29 +03:30
parent 5689cb4267
commit 27fc134ffe
13 changed files with 888 additions and 119 deletions
@@ -315,4 +315,27 @@ public class PrivateChatDatabase {
return null;
}
public static boolean isParticipant(java.util.UUID chatId, java.util.UUID userId) {
String sql = """
SELECT 1
FROM private_chat
WHERE chat_id = ?
AND (user1_id = ? OR user2_id = ?)
LIMIT 1
""";
try (var c = ConnectionDb.connect();
var ps = c.prepareStatement(sql)) {
ps.setObject(1, chatId);
ps.setObject(2, userId);
ps.setObject(3, userId);
try (var rs = ps.executeQuery()) {
return rs.next();
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}