Removed lnurlp tests

This commit is contained in:
ben
2023-01-12 22:39:20 +00:00
parent 6d8896c2f6
commit 6e33784061
2 changed files with 17 additions and 2 deletions

View File

@@ -647,3 +647,15 @@ async def get_tinyurl(tinyurl_id: str) -> Optional[BalanceCheck]:
(tinyurl_id),
)
return TinyURL.from_row(row) if row else None
async def get_tinyurl_by_url(url: str) -> Optional[BalanceCheck]:
row = await db.fetchone(
"""
SELECT *
FROM tiny_url
WHERE url = ?
""",
(url),
)
return TinyURL.from_row(row) if row else None

View File

@@ -51,6 +51,7 @@ from ..crud import (
get_payments,
get_standalone_payment,
get_tinyurl,
get_tinyurl_by_url,
get_total_balance,
get_wallet_for_key,
save_balance_check,
@@ -715,15 +716,17 @@ async def websocket_update_get(item_id: str, data: str):
@core_app.post("/api/v1/tinyurl")
async def api_create_tinyurl(url: str):
tinyurl = await get_tinyurl_by_url(url)
if tinyurl:
return tinyurl
return await create_tinyurl(url)
@core_app.get("/api/v1/tinyurl/{tinyurl_id}")
async def api_get_tinyurl(tinyurl_id: str):
return await get_tinyurl(tinyurl_id)
@core_app.get("/{tinyurl_id}")
@core_app.get("/t/{tinyurl_id}")
async def api_tinyurl(tinyurl_id: str):
tinyurl = await get_tinyurl(tinyurl_id)
if tinyurl: