From 5f3e52d8a63e329e22543ac0762fbf708684c8e2 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Sat, 4 Jul 2026 13:24:24 +0000 Subject: [PATCH] Debug: expose full raw booking in debug-room; fix guest name extraction - debug-room now returns full raw NewBook booking objects so all field names are visible for diagnosis - guest_name extraction also tries guests[0].firstname+lastname (original PHP plugin pattern), not just guests[0].guest_name Co-Authored-By: Claude Sonnet 4.6 --- backend/src/routes/rooms.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/src/routes/rooms.js b/backend/src/routes/rooms.js index 618da9c..b62c29f 100644 --- a/backend/src/routes/rooms.js +++ b/backend/src/routes/rooms.js @@ -44,7 +44,11 @@ function filterBookingData(booking, canSeeGuest, canSeeRate, canSeeAllNotes, vis if (canSeeGuest) { const guests = booking.guests || [] - out.guest_name = guests[0]?.guest_name || booking.guest_name || booking.account_for_name || null + const g0 = guests[0] + const fromGuests = g0 + ? (g0.guest_name || [g0.firstname, g0.lastname].filter(Boolean).join(' ') || null) + : null + out.guest_name = fromGuests || booking.guest_name || booking.account_for_name || null } if (canSeeRate) { @@ -119,13 +123,7 @@ export async function roomRoutes(app) { site: { id: siteId, name: site.site_name, fields: Object.keys(site) }, booking_id_fields: idFields, total_bookings_fetched: bookings.length, - matching_bookings: siteBookings.map(b => { - const out = {} - for (const f of ['booking_id', 'booking_status', 'booking_arrival', 'booking_departure', ...idFields]) { - out[f] = b[f] - } - return out - }), + matching_bookings: siteBookings, classified: { flow_type: classified.flow_type, spans_previous: classified.spans_previous,