[+] Fixed positional argument in Firestore query

This commit is contained in:
Charles Le Maux 2024-09-09 23:16:30 +02:00
parent 9042bae61e
commit 1123b7f60d

View File

@ -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