Compare commits

...

2 Commits

Author SHA1 Message Date
Logan Cusano
776b3d9ac2 Fix active/all token issues
All checks were successful
release-image / release-image (push) Successful in 3m15s
2025-07-06 20:16:56 -04:00
Logan Cusano
1658ea2e83 Fix spacing 2025-07-06 19:55:17 -04:00
2 changed files with 13 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ class SystemDbController():
if found_docs:
print("Found document (raw dict):", found_docs)
converted_systems = [System.from_dict(doc) for doc in found_docs]
print("YURB", found_docs, converted_systems)
print("Found document (converted):", converted_systems)
return converted_systems if len(converted_systems) > 0 else None
else:
print("Document not found.")
@@ -83,12 +83,17 @@ class SystemDbController():
print(f"Find failed: {e}")
return None
async def find_all_systems(self, query: Dict[str, Any] = {}) -> List[System]:
async def find_all_systems(self, query: Optional[Dict[str, Any]] = None) -> List[System]:
print("\n--- Finding multiple documents ---")
try:
# Initialize an empty dictionary if no query is provided
if query is None:
query = {}
found_docs = None
async with self.db_h as db: #
found_docs = await db.find(query) #
if found_docs:
print(f"Found {len(found_docs)} documents (raw dicts).")
return [System.from_dict(doc) for doc in found_docs]
@@ -160,11 +165,9 @@ class DiscordIdDbController():
print(f"Discord ID create failed: {e}")
return None
async def find_discord_id(self, query: Dict[str, Any], active_only: bool = False) -> Optional[DiscordId]:
async def find_discord_id(self, query: Dict[str, Any]) -> Optional[DiscordId]:
print("\n--- Finding one Discord ID document ---")
try:
if active_only:
query["active"] = True
found_doc = None
async with self.db_h as db: #
found_doc = await db.find_one(query) #
@@ -178,9 +181,12 @@ class DiscordIdDbController():
print(f"Discord ID find failed: {e}")
return None
async def find_discord_ids(self, query: Dict[str, Any] = {}, guild_id: Optional[str] = None, active_only: bool = False) -> Optional[List[DiscordId]]:
async def find_discord_ids(self, query: Optional[Dict[str, Any]] = None, guild_id: Optional[str] = None, active_only: bool = False) -> Optional[List[DiscordId]]:
print("\n--- Finding multiple Discord ID documents ---")
try:
if query is None:
query = {}
if active_only == True:
print("Searching active IDs")
query["active"] = True

View File

@@ -162,6 +162,7 @@ async def delete_system_route(system_id: str):
print(f"Error in delete_system_route: {e}")
abort(500, f"An internal error occurred: {e}")
@systems_bp.route('/<string:system_id>/assign', methods=['POST'])
@jwt_required
@role_required(UserRoles.MOD)