This commit is contained in:
ben 2023-01-12 20:37:03 +00:00
parent e28a6c228e
commit 6d8896c2f6
3 changed files with 8 additions and 5 deletions

View File

@ -626,9 +626,9 @@ async def create_admin_settings(super_user: str, new_settings: dict):
# -------
async def create_tinyurl(tiny_url: str):
async def create_tinyurl(domain: str):
tinyurl_id = uuid4().hex[:8]
await (conn or db).execute(
await db.execute(
"""
INSERT INTO tiny_url (id, url) VALUES (?, ?)
""",
@ -638,7 +638,7 @@ async def create_tinyurl(tiny_url: str):
async def get_tinyurl(tinyurl_id: str) -> Optional[BalanceCheck]:
row = await (conn or db).fetchone(
row = await db.fetchone(
"""
SELECT *
FROM tiny_url

View File

@ -270,10 +270,11 @@ async def m008_create_admin_settings_table(db):
"""
)
async def m009_create_tinyurl_table(db):
await db.execute(
"""
CREATE TABLE IF NOT EXISTS tinyurl (
CREATE TABLE IF NOT EXISTS tiny_url (
id TEXT PRIMARY KEY,
url TEXT
);

View File

@ -26,7 +26,7 @@ from loguru import logger
from pydantic import BaseModel
from pydantic.fields import Field
from sse_starlette.sse import EventSourceResponse
from starlette.responses import StreamingResponse
from starlette.responses import RedirectResponse, StreamingResponse
from lnbits import bolt11, lnurl
from lnbits.core.models import Payment, Wallet
@ -47,8 +47,10 @@ from lnbits.utils.exchange_rates import (
from .. import core_app, db
from ..crud import (
create_tinyurl,
get_payments,
get_standalone_payment,
get_tinyurl,
get_total_balance,
get_wallet_for_key,
save_balance_check,