fix(reservations): a booking read on its own carries its day slots, so an edit no longer drops them

The create and update answers, the reservation:updated broadcast and the MCP
reservation tools all hand back the single booking read, and that read never
loaded reservation_day_positions. The day list puts a booking moved on a day by
that slot before its time, and the client replaces the booking with the answer,
so a booking moved on a day jumped back to its time after every edit until the
next reload. The read now attaches day_positions in the shape the trip list
already sends.

Refs #2631
This commit is contained in:
Maurice
2026-10-12 12:32:24 +02:00
parent c2dd66986c
commit eaab7dc4e4
12 changed files with 108 additions and 7 deletions
@@ -75,4 +75,14 @@ describe('ReservationDayPositionsRepository — fully seeded world', () => {
const trip = createTrip(testDb, user.id);
expect(await repo.listForTrip(trip.id)).toEqual([]);
});
it('listForReservation — the slots of one booking per day, none of another booking', async () => {
const { multiDay, day1, day2 } = await seed();
const rows = await repo.listForReservation(multiDay.id);
expect(rows.map((r) => [r.day_id, r.position]).sort()).toEqual([
[day1.id, 0],
[day2.id, 1],
]);
expect(await repo.listForReservation(999999)).toEqual([]);
});
});