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
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:
parent
b467826622
commit
7843da21d8
2 changed files with 30 additions and 2 deletions
|
|
@ -202,11 +202,13 @@ window.app = Vue.createApp({
|
|||
LNbits.utils.exportCSV(this.ticketsTable.columns, this.tickets)
|
||||
},
|
||||
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_wallets=true',
|
||||
this.g.user.wallets[0].inkey
|
||||
'/events/api/v1/events/all',
|
||||
this.g.user.wallets[0].adminkey
|
||||
)
|
||||
.then(response => {
|
||||
this.events = response.data.map(obj => {
|
||||
|
|
@ -214,6 +216,21 @@ window.app = Vue.createApp({
|
|||
})
|
||||
this.checkCanceledEvents()
|
||||
})
|
||||
.catch(() => {
|
||||
// Not admin, fall back to own events
|
||||
LNbits.api
|
||||
.request(
|
||||
'GET',
|
||||
'/events/api/v1/events?all_wallets=true',
|
||||
this.g.user.wallets[0].inkey
|
||||
)
|
||||
.then(response => {
|
||||
this.events = response.data.map(obj => {
|
||||
return mapEvents(obj)
|
||||
})
|
||||
this.checkCanceledEvents()
|
||||
})
|
||||
})
|
||||
},
|
||||
getPendingEvents() {
|
||||
LNbits.api
|
||||
|
|
|
|||
11
views_api.py
11
views_api.py
|
|
@ -63,6 +63,17 @@ async def api_events_public():
|
|||
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.put("/api/v1/events/{event_id}")
|
||||
async def api_event_create(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue