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
@@ -32,6 +32,20 @@ export class ReservationDayPositionsRepository extends TrekRepository<Reservatio
.execute<{ reservation_id: number; day_id: number; position: number }[]>('all', false);
}
/**
* `SELECT day_id, position FROM reservation_day_positions WHERE reservation_id = ?`:
* one booking's slots, for the single-booking read the create, update and
* broadcast payloads come from. Without them a booking moved on a day lost
* that slot in the list after every edit until the next reload (#2631).
*/
async listForReservation(reservation_id: number): Promise<{ day_id: number; position: number }[]> {
return this.kysely<ReservationDayPositionsKyselyDB>()
.selectFrom('reservation_day_positions')
.select(['day_id', 'position'])
.where('reservation_id', '=', reservation_id)
.execute();
}
/**
* RS31 (`ReservationsService.updatePositions`'s day branch) — `INSERT OR
* REPLACE INTO reservation_day_positions (reservation_id, day_id,