checks before creating new subdomain

This commit is contained in:
Kristjan
2021-01-03 00:26:33 +01:00
parent dc4a786dda
commit 33b48341f1
3 changed files with 18 additions and 6 deletions
+8 -2
View File
@@ -4,8 +4,6 @@ from lnbits.helpers import urlsafe_short_hash
from . import db
from .models import Domains, Subdomains
import httpx
from lnbits.extensions import subdomains
@@ -73,6 +71,14 @@ async def get_subdomain(subdomain_id: str) -> Optional[Subdomains]:
print(row)
return Subdomains(**row) if row else None
async def get_subdomainBySubdomain(subdomain: str) -> Optional[Subdomains]:
row = await db.fetchone(
"SELECT s.*, d.domain as domain_name FROM subdomain s INNER JOIN domain d ON (s.domain = d.id) WHERE s.subdomain = ?",
(subdomain, ),
)
print(row)
return Subdomains(**row) if row else None
async def get_subdomains(wallet_ids: Union[str, List[str]]) -> List[Subdomains]:
if isinstance(wallet_ids, str):