From 1123b7f60d164c9592abeec4c176f6fbfb9223b1 Mon Sep 17 00:00:00 2001 From: Charles Le Maux Date: Mon, 9 Sep 2024 23:16:30 +0200 Subject: [PATCH] [+] Fixed positional argument in Firestore query --- firebase_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firebase_manager.py b/firebase_manager.py index a97a3c6..6db0a6d 100644 --- a/firebase_manager.py +++ b/firebase_manager.py @@ -6,6 +6,7 @@ import firebase_admin import jwt from firebase_admin import auth, credentials, firestore from google.api_core.exceptions import Aborted, DataLoss, NotFound, OutOfRange, PermissionDenied, ResourceExhausted +from google.cloud.firestore_v1 import FieldFilter import file_manager from generic_executor import mc_manager @@ -51,7 +52,7 @@ def user_field_exists(user_id: str) -> bool: def server_name_taken(user_id: str, server_name: str) -> bool: servers = firestore_database.collection('users').document(user_id).collection('servers') - query = servers.where(field_path='name', op_string='==', value=server_name) + query = servers.where(filter=FieldFilter(field_path='name', op_string='==', value=server_name)) for _ in query.stream(): return True return False