From 23df2ceced5026e665dab5b9adc63de915da1626 Mon Sep 17 00:00:00 2001 From: agent Date: Sun, 25 Oct 2026 20:12:46 +0000 Subject: [PATCH] Shop hooks: a slot lookup by id returns all of that slot's bookings Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW --- pocketbase/pb_hooks/shop/lib.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pocketbase/pb_hooks/shop/lib.js b/pocketbase/pb_hooks/shop/lib.js index 9a0d2e8..5bfa13c 100644 --- a/pocketbase/pb_hooks/shop/lib.js +++ b/pocketbase/pb_hooks/shop/lib.js @@ -308,6 +308,8 @@ function bookableTimes(app, query) { /** * Every slot in a range (or one slot by id) with its bookings — for the * signed-in admin. `query`: from/to (ISO), optional item, or id. + * `bookings`: every booked/held time starting in the range, or for one + * slot, that slot's own. */ function slotDetails(app, query) { let slots; @@ -343,7 +345,7 @@ function slotDetails(app, query) { } return detail; }), - bookings: busy.filter((b) => b.start >= from && b.start < to).map(booking) + bookings: busy.filter((b) => (query.id ? b.slot === String(query.id) : b.start >= from && b.start < to)).map(booking) }; }