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 <noreply@anthropic.com>
This commit is contained in:
parent
d0e80c2484
commit
5f3e52d8a6
1 changed files with 6 additions and 8 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue