feat: add admin endpoint to view all events across wallets
Some checks failed
lint.yml / feat: add admin endpoint to view all events across wallets (pull_request) Failing after 0s

- GET /api/v1/events/all — returns all events regardless of wallet (admin key)
- Admin UI tries /events/all first, falls back to own wallet events
- Approved events from other users now visible in admin events table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-04-27 11:19:21 +02:00
commit 7843da21d8
2 changed files with 30 additions and 2 deletions

View file

@ -202,6 +202,22 @@ window.app = Vue.createApp({
LNbits.utils.exportCSV(this.ticketsTable.columns, this.tickets) LNbits.utils.exportCSV(this.ticketsTable.columns, this.tickets)
}, },
getEvents() { getEvents() {
// Try admin endpoint first (shows all events across all wallets)
// Falls back to user's own events if not admin
LNbits.api
.request(
'GET',
'/events/api/v1/events/all',
this.g.user.wallets[0].adminkey
)
.then(response => {
this.events = response.data.map(obj => {
return mapEvents(obj)
})
this.checkCanceledEvents()
})
.catch(() => {
// Not admin, fall back to own events
LNbits.api LNbits.api
.request( .request(
'GET', 'GET',
@ -214,6 +230,7 @@ window.app = Vue.createApp({
}) })
this.checkCanceledEvents() this.checkCanceledEvents()
}) })
})
}, },
getPendingEvents() { getPendingEvents() {
LNbits.api LNbits.api

View file

@ -63,6 +63,17 @@ async def api_events_public():
return [event.dict() for event in events] return [event.dict() for event in events]
@events_api_router.get("/api/v1/events/all")
async def api_events_all(
wallet: WalletTypeInfo = Depends(require_admin_key),
):
"""Get all events across all wallets. Admin only."""
from .crud import get_all_events
events = await get_all_events()
return [event.dict() for event in events]
@events_api_router.post("/api/v1/events") @events_api_router.post("/api/v1/events")
@events_api_router.put("/api/v1/events/{event_id}") @events_api_router.put("/api/v1/events/{event_id}")
async def api_event_create( async def api_event_create(