chore: code format

This commit is contained in:
Vlad Stan 2023-02-10 17:25:02 +02:00
parent 8678090e7b
commit ebada934b0
6 changed files with 32 additions and 29 deletions

View file

@ -61,13 +61,12 @@ async def get_relay(user_id: str, relay_id: str) -> Optional[NostrRelay]:
return NostrRelay.from_row(row) if row else None
async def get_relay_by_id(relay_id: str) -> Optional[NostrRelay]:
"""Note: it does not require `user_id`. Can read any relay. Use it with care."""
row = await db.fetchone(
"""SELECT * FROM nostrrelay.relays WHERE id = ?""",
(
relay_id,
),
(relay_id,),
)
return NostrRelay.from_row(row) if row else None
@ -111,7 +110,7 @@ async def get_public_relay(relay_id: str) -> Optional[dict]:
"description": relay.description,
"pubkey": relay.pubkey,
"contact": relay.contact,
"config": RelayPublicSpec(**dict(relay.config)).dict(by_alias=True)
"config": RelayPublicSpec(**dict(relay.config)).dict(by_alias=True),
}