mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 21:46:49 +00:00
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:
@@ -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([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user