fix(reservations): a night booked on the form belongs on the drive too

The booking form wrote the stay row itself, so it was the one door that left the
day stop out. A hotel entered there stayed invisible to road trip mode, which is
the same complaint as before with a different way in: enter the place twice or it
is not on the route.

It writes the stop now, through AccommodationsService rather than a second copy of
its SQL. The permission argument for not doing so does not hold: the night already
shows in the day header the moment the booking is saved, and the stop is that same
night in the other view, not a second edit to the plan.

Two holes go with it. Moving the booking left the stop on a day nobody sleeps there
any more, and deleting it left the stop behind entirely — in both cases still
carrying the booking's id, which is what the day list hides on, so nobody could
reach it to remove it. The stop now follows the stay and goes with it, and only
once the trip_id guard has confirmed the stay was this trip's to delete.
This commit is contained in:
Maurice
2026-09-13 12:38:21 +02:00
parent eff4605ef3
commit e3471e2dc8
12 changed files with 295 additions and 52 deletions
@@ -22,6 +22,7 @@ import { ReservationsReadRepository } from '../../../src/nest/reservations/reser
import type { AirtrailClient } from '../../../src/nest/integrations/airtrail.client';
import type { AirtrailService } from '../../../src/nest/integrations/airtrail.service';
import { notificationsStub } from '../../helpers/notifications';
import { accommodationsOver } from '../../helpers/accommodations-service';
// The client and the per-user credentials are the only stubs; the reservation
// writes go through the real service against the real test DB, as before. They
@@ -43,6 +44,7 @@ function makeImportService(): AirtrailImportService {
realtime,
notificationsStub(),
new ReservationsReadRepository(dbs()),
accommodationsOver(dbs()),
),
{ listFlights } as unknown as AirtrailClient,
{