-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.
This commit is contained in:
parent
3dc066fbd4
commit
5a1a400f45
1 changed files with 2 additions and 2 deletions
4
crud.py
4
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue