diff --git a/crud.py b/crud.py index c8285e6..e476d24 100644 --- a/crud.py +++ b/crud.py @@ -43,6 +43,7 @@ async def create_charge( INSERT INTO satspay.charges ( id, "user", + name, description, onchainwallet, onchainaddress, @@ -59,11 +60,12 @@ async def create_charge( extra, custom_css ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) """, ( charge_id, user, + data.name, data.description, data.onchainwallet, onchainaddress, diff --git a/helpers.py b/helpers.py index e2dad6f..9091487 100644 --- a/helpers.py +++ b/helpers.py @@ -11,6 +11,7 @@ def public_charge(charge: Charges): c = { "id": charge.id, + "name": charge.name, "description": charge.description, "onchainaddress": charge.onchainaddress, "payment_request": charge.payment_request, diff --git a/migrations.py b/migrations.py index d7b3ca0..fddb2d2 100644 --- a/migrations.py +++ b/migrations.py @@ -112,3 +112,13 @@ async def m007_add_pending_column(db): ) except OperationalError: pass + + +async def m008_add_name_column(db): + """ + Add 'name' column for storing the name of the charge + """ + try: + await db.execute(f"ALTER TABLE satspay.charges ADD COLUMN name TEXT;") + except OperationalError: + pass diff --git a/models.py b/models.py index d91d7ea..86c35eb 100644 --- a/models.py +++ b/models.py @@ -14,6 +14,7 @@ class CreateCharge(BaseModel): onchainwallet: str = Query(None) lnbitswallet: str = Query(None) + name: str = Query(None) description: str = Query(...) webhook: str = Query(None) completelink: str = Query(None) @@ -34,6 +35,7 @@ class ChargeConfig(BaseModel): class Charges(BaseModel): id: str + name: Optional[str] description: Optional[str] onchainwallet: Optional[str] onchainaddress: Optional[str] diff --git a/static/js/components.js b/static/js/components.js index 72af8a3..8e70cfe 100644 --- a/static/js/components.js +++ b/static/js/components.js @@ -32,6 +32,7 @@ Vue.component('satspay-paid', { Vue.component('satspay-show-qr', { props: ['charge-amount', 'type', 'value', 'href'], + mixins: [windowMixin], template: `