works
This commit is contained in:
parent
e28a6c228e
commit
6d8896c2f6
3 changed files with 8 additions and 5 deletions
|
|
@ -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]
|
tinyurl_id = uuid4().hex[:8]
|
||||||
await (conn or db).execute(
|
await db.execute(
|
||||||
"""
|
"""
|
||||||
INSERT INTO tiny_url (id, url) VALUES (?, ?)
|
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]:
|
async def get_tinyurl(tinyurl_id: str) -> Optional[BalanceCheck]:
|
||||||
row = await (conn or db).fetchone(
|
row = await db.fetchone(
|
||||||
"""
|
"""
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM tiny_url
|
FROM tiny_url
|
||||||
|
|
|
||||||
|
|
@ -270,10 +270,11 @@ async def m008_create_admin_settings_table(db):
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def m009_create_tinyurl_table(db):
|
async def m009_create_tinyurl_table(db):
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE IF NOT EXISTS tinyurl (
|
CREATE TABLE IF NOT EXISTS tiny_url (
|
||||||
id TEXT PRIMARY KEY,
|
id TEXT PRIMARY KEY,
|
||||||
url TEXT
|
url TEXT
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ from loguru import logger
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from pydantic.fields import Field
|
from pydantic.fields import Field
|
||||||
from sse_starlette.sse import EventSourceResponse
|
from sse_starlette.sse import EventSourceResponse
|
||||||
from starlette.responses import StreamingResponse
|
from starlette.responses import RedirectResponse, StreamingResponse
|
||||||
|
|
||||||
from lnbits import bolt11, lnurl
|
from lnbits import bolt11, lnurl
|
||||||
from lnbits.core.models import Payment, Wallet
|
from lnbits.core.models import Payment, Wallet
|
||||||
|
|
@ -47,8 +47,10 @@ from lnbits.utils.exchange_rates import (
|
||||||
|
|
||||||
from .. import core_app, db
|
from .. import core_app, db
|
||||||
from ..crud import (
|
from ..crud import (
|
||||||
|
create_tinyurl,
|
||||||
get_payments,
|
get_payments,
|
||||||
get_standalone_payment,
|
get_standalone_payment,
|
||||||
|
get_tinyurl,
|
||||||
get_total_balance,
|
get_total_balance,
|
||||||
get_wallet_for_key,
|
get_wallet_for_key,
|
||||||
save_balance_check,
|
save_balance_check,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue