feat: returned the installed release

This commit is contained in:
Vlad Stan
2023-01-18 17:38:51 +02:00
parent 12060b67ad
commit 6b360b927c
5 changed files with 50 additions and 30 deletions
+2 -10
View File
@@ -6,7 +6,6 @@ from uuid import uuid4
from lnbits import bolt11
from lnbits.db import COCKROACH, POSTGRES, Connection
from lnbits.extension_manger import ExtensionRelease, InstallableExtension
from lnbits.settings import AdminSettings, EditableSettings, SuperSettings, settings
from . import db
@@ -122,9 +121,7 @@ async def delete_installed_extension(
)
async def get_installed_extension(
ext_id: str, conn: Optional[Connection] = None
) -> InstallableExtension:
async def get_installed_extension(ext_id: str, conn: Optional[Connection] = None):
row = await (conn or db).fetchone(
"SELECT * FROM installed_extensions WHERE id = ?",
(ext_id,),
@@ -132,12 +129,7 @@ async def get_installed_extension(
if not row:
return None
data = dict(row)
meta = json.loads(data["meta"])
ext = InstallableExtension(**data)
if "installed_release" in meta:
ext.installed_release = ExtensionRelease(**meta["installed_release"])
return ext
return dict(row)
async def get_inactive_extensions(*, conn: Optional[Connection] = None) -> List[str]: