From 592a52e9a2df228534271ee2a07946bfceda7aca Mon Sep 17 00:00:00 2001 From: Black Coffee Date: Thu, 17 Nov 2022 14:13:20 +0000 Subject: [PATCH] Added type to Gerty extension Vue, migration and Crud --- lnbits/extensions/gerty/crud.py | 4 +++- lnbits/extensions/gerty/migrations.py | 6 ++++++ lnbits/extensions/gerty/models.py | 1 + lnbits/extensions/gerty/templates/gerty/index.html | 13 +++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lnbits/extensions/gerty/crud.py b/lnbits/extensions/gerty/crud.py index 3850737f..1b179d50 100644 --- a/lnbits/extensions/gerty/crud.py +++ b/lnbits/extensions/gerty/crud.py @@ -15,19 +15,21 @@ async def create_gerty(wallet_id: str, data: Gerty) -> Gerty: name, wallet, utc_offset, + type, lnbits_wallets, mempool_endpoint, exchange, display_preferences, refresh_time ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) """, ( gerty_id, data.name, data.wallet, data.utc_offset, + data.type, data.lnbits_wallets, data.mempool_endpoint, data.exchange, diff --git a/lnbits/extensions/gerty/migrations.py b/lnbits/extensions/gerty/migrations.py index e98fc4f2..b283ee56 100644 --- a/lnbits/extensions/gerty/migrations.py +++ b/lnbits/extensions/gerty/migrations.py @@ -23,3 +23,9 @@ async def m002_add_utc_offset_col(db): support for UTC offset """ await db.execute("ALTER TABLE gerty.gertys ADD COLUMN utc_offset INT;") + +async def m003_add_gerty_model_col(db): + """ + support for Gerty model col + """ + await db.execute("ALTER TABLE gerty.gertys ADD COLUMN type TEXT;") \ No newline at end of file diff --git a/lnbits/extensions/gerty/models.py b/lnbits/extensions/gerty/models.py index 855a30c9..44704f82 100644 --- a/lnbits/extensions/gerty/models.py +++ b/lnbits/extensions/gerty/models.py @@ -11,6 +11,7 @@ class Gerty(BaseModel): wallet: str refresh_time: int = Query(None) utc_offset: int = Query(None) + type: str lnbits_wallets: str = Query( None ) # Wallets to keep an eye on, {"wallet-id": "wallet-read-key, etc"} diff --git a/lnbits/extensions/gerty/templates/gerty/index.html b/lnbits/extensions/gerty/templates/gerty/index.html index 55e67a2d..c91f6997 100644 --- a/lnbits/extensions/gerty/templates/gerty/index.html +++ b/lnbits/extensions/gerty/templates/gerty/index.html @@ -127,6 +127,14 @@ label="Name" placeholder="Son of Gerty" > +