Added type to Gerty extension Vue, migration and Crud

This commit is contained in:
Black Coffee 2022-11-17 14:13:20 +00:00
parent df56b84ad2
commit 592a52e9a2
4 changed files with 23 additions and 1 deletions

View file

@ -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,

View file

@ -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;")

View file

@ -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"}

View file

@ -127,6 +127,14 @@
label="Name"
placeholder="Son of Gerty"
></q-input>
<q-select
filled
dense
emit-value
v-model="formDialog.data.type"
:options="['Gerty', 'Mini Gerty']"
label="Gerty Type *"
></q-select>
<q-select
filled
dense
@ -583,6 +591,7 @@
show: false,
data: {
utc_offset: 0,
type: 'Gerty',
display_preferences: {
dashboard: true,
fun_satoshi_quotes: true,
@ -619,6 +628,7 @@
lnbits_wallets: [],
mempool_endpoint: "https://mempool.space",
refresh_time: 300,
type: 'Gerty',
display_preferences: {},
}
},
@ -641,6 +651,7 @@
console.log('gerty.display_preferences', gerty.display_preferences)
this.formDialog.data.id = gerty.id
this.formDialog.data.name = gerty.name
this.formDialog.data.type = gerty.type
this.formDialog.data.wallet = gerty.wallet
this.formDialog.data.utc_offset = gerty.utc_offset
this.formDialog.data.lnbits_wallets = JSON.parse(gerty.lnbits_wallets)
@ -669,6 +680,7 @@
name: this.formDialog.data.name,
wallet: this.formDialog.data.wallet,
utc_offset: this.formDialog.data.utc_offset,
type: this.formDialog.data.type,
lnbits_wallets: JSON.stringify(this.formDialog.data.lnbits_wallets),
exchange: this.formDialog.data.exchange,
mempool_endpoint: this.formDialog.data.mempool_endpoint,
@ -697,6 +709,7 @@
updateGerty: function (wallet, data) {
var self = this
data.utc_offset = this.formDialog.data.utc_offset
data.type = this.formDialog.data.type
data.lnbits_wallets = JSON.stringify(this.formDialog.data.lnbits_wallets)
data.display_preferences = JSON.stringify(this.formDialog.data.display_preferences)
LNbits.api