From 5a1a400f45e056ecb760a3a5ad7203939d45a77d Mon Sep 17 00:00:00 2001 From: 21M4TW <134294118+21M4TW@users.noreply.github.com> Date: Mon, 16 Jun 2025 08:59:13 +0000 Subject: [PATCH] -Two issues were dicovered in get_config_for_all_active_relays which led (#32) to errors while loading relay configuration from the DB and that also caused the loaded meta information to be invalid. Mandatory fields for NostrRelay were not selected by the query, and a dictionary representation of the meta object should not be returned as it causes some members such as require_auth_filter and event_requires_auth to not be accessible, leading to breaking exceptions. --- crud.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crud.py b/crud.py index 0b977b5..a084c3a 100644 --- a/crud.py +++ b/crud.py @@ -48,12 +48,12 @@ async def get_relays(user_id: str) -> list[NostrRelay]: async def get_config_for_all_active_relays() -> dict: relays = await db.fetchall( - "SELECT id, meta FROM nostrrelay.relays WHERE active = true", + "SELECT * FROM nostrrelay.relays WHERE active = true", model=NostrRelay, ) active_relay_configs = {} for relay in relays: - active_relay_configs[relay.id] = relay.meta.dict() + active_relay_configs[relay.id] = relay.meta return active_relay_configs