feat(api): a guest's own bookings on both doors

GET /api/v1/bookings/mine (LNbits account auth; identity = the account's
Nostr pubkey, the same value the booking request carried) and RPC twin
chatelet_booking_list_mine (scoped by the signed sender_pubkey). Rows come
back newest check-in first via the m003 guest index, as guest_booking_dict:
the guest's own contact and counts, minus the Lightning/Nostr plumbing.
Declared ahead of /bookings/{booking_id} so 'mine' is not read as an id.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-09-16 12:17:39 +02:00
commit 8b816d83b0
8 changed files with 140 additions and 2 deletions

View file

@ -36,6 +36,7 @@ from .models import (
Room,
RoomStatus,
UnavailableRanges,
guest_booking_dict,
public_room_dict,
)
@ -151,6 +152,12 @@ async def public_room_views(rooms: list[Room]) -> list[dict]:
return out
async def list_guest_bookings(guest_pubkey: str) -> list[dict]:
"""The caller's own bookings (identity established by the door: LNbits
account pubkey over HTTP, signed sender_pubkey over RPC)."""
return [guest_booking_dict(b) for b in await crud.get_bookings_for_guest(guest_pubkey)]
# A guest calendar asks for a year by default; cap the window so a bad client
# can't make us scan and ship an unbounded span.
DEFAULT_CALENDAR_DAYS = 365