diff --git a/lnbits/extensions/events/crud.py b/lnbits/extensions/events/crud.py index 4a24b797..dc7db93a 100644 --- a/lnbits/extensions/events/crud.py +++ b/lnbits/extensions/events/crud.py @@ -74,6 +74,9 @@ async def get_tickets(wallet_ids: Union[str, List[str]]) -> List[Tickets]: async def delete_ticket(payment_hash: str) -> None: await db.execute("DELETE FROM events.ticket WHERE id = ?", (payment_hash,)) +async def delete_event_tickets(event_id: str) -> None: + await db.execute("DELETE FROM events.tickets WHERE event = ?", (event_id,)) + # EVENTS diff --git a/lnbits/extensions/events/templates/events/index.html b/lnbits/extensions/events/templates/events/index.html index c2d81960..409ed2af 100644 --- a/lnbits/extensions/events/templates/events/index.html +++ b/lnbits/extensions/events/templates/events/index.html @@ -380,14 +380,14 @@ methods: { getTickets: function () { var self = this - console.log('obj') LNbits.api - .request( - 'GET', - '/events/api/v1/tickets?all_wallets', - this.g.user.wallets[0].inkey + .request( + 'GET', + '/events/api/v1/tickets?all_wallets=true', + this.g.user.wallets[0].inkey ) .then(function (response) { + console.log(response) self.tickets = response.data.map(function (obj) { console.log(obj) return mapEvents(obj) diff --git a/lnbits/extensions/events/views_api.py b/lnbits/extensions/events/views_api.py index 5dae31e1..4ff93c31 100644 --- a/lnbits/extensions/events/views_api.py +++ b/lnbits/extensions/events/views_api.py @@ -15,6 +15,7 @@ from .crud import ( create_event, create_ticket, delete_event, + delete_event_tickets, delete_ticket, get_event, get_event_tickets, @@ -81,6 +82,7 @@ async def api_form_delete(event_id, wallet: WalletTypeInfo = Depends(get_key_typ ) await delete_event(event_id) + await delete_event_tickets(event_id) raise HTTPException(status_code=HTTPStatus.NO_CONTENT)