feat: create invoice to join

This commit is contained in:
Vlad Stan 2023-02-10 17:20:55 +02:00
parent db3ad2e32f
commit 8678090e7b
5 changed files with 176 additions and 8 deletions

13
crud.py
View file

@ -61,6 +61,17 @@ 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,
),
)
return NostrRelay.from_row(row) if row else None
async def get_relays(user_id: str) -> List[NostrRelay]:
rows = await db.fetchall(
@ -100,7 +111,7 @@ async def get_public_relay(relay_id: str) -> Optional[dict]:
"description": relay.description,
"pubkey": relay.pubkey,
"contact": relay.contact,
"config": dict(RelayPublicSpec(**dict(relay.config)))
"config": RelayPublicSpec(**dict(relay.config)).dict(by_alias=True)
}