Files
TREK/server/src/nest/days/days.module.ts
T
Maurice 2f6f921aef feat(dayplan): a day can be deleted from the reorder dialog, after a warning that says what goes with it
Every row of the reorder dialog, and of the days sheet on a phone, now has a delete button. It first asks, and the question lists what goes with the day: planned places stay in the place list, notes and day texts are deleted, bookings stay without a day, a stay that checks in or out on the day is cancelled with its booking and expense (shown in the danger tone), and on a dated trip the later days and their bookings move one date earlier or the trip ends a day earlier.

The server side moved from a bare DELETE into DayRemovalService, which REST, the delete_day tool and the plugin RPC all use. It closes the numbering, keeps the dates on their positions like a reorder, re-stamps the moved bookings, shifts the road trip boundaries, cancels touching stays through the accommodations domain, refuses the last day of a trip, and fans out day:deleted, day:reordered and trip:updated so collaborators renumber and see the new day count and end date. The trip query moved into a leaf file so the days domain can read it without a module cycle.

On the client the delete is online only, runs optimistically through the days slice with the same reducer collaborators apply, and the ConfirmDialog gained a slot for extra content, an Escape that only closes itself, and the danger and accent tokens.
2026-09-23 22:40:46 +02:00

41 lines
2.0 KiB
TypeScript

import { Module } from '@nestjs/common';
import { DaysController } from './days.controller';
import { DaysService } from './days.service';
import { DaysMcp } from './days.mcp';
import { DaysRpc } from './days.rpc';
import { DayRemovalService } from './day-removal.service';
import { AccommodationsDomainModule } from '../accommodations/accommodations-domain.module';
import { AssignmentsDomainModule } from '../assignments/assignments-domain.module';
import { PluginGuardsModule } from '../plugins/host/plugin-guards.module';
import { RealtimeModule } from '../realtime/realtime.module';
import { PermissionsModule } from '../permissions/permissions.module';
import { QueryHelpersModule } from '../query-helpers/query-helpers.module';
import { PlacesModule } from '../places/places.module';
import { AuthModule } from '../auth/auth.module';
import { McpSharedModule } from '../mcp-shared/mcp-shared.module';
/**
* Days (S6 — Phase 2 trip sub-domain), mounted at /api/trips/:tripId/days.
* DaysMcp carries the decorator-registered MCP tools + resources. DaysService is
* exported for in-container consumers (DaysRpc, AccommodationsService,
* TripsService, the assignments/reservations MCP controllers).
*
* Day notes used to live here too, with their own full file set; they are their
* own domain now (day-notes/).
*
* Deleting a day cancels the stays that check in or out on it and lets the
* journey catch up, so DayRemovalService needs the accommodations and
* assignments services. Both domain modules are leaves (neither reaches days or
* places), and PlacesModule already brings them in, so the edge adds no cycle.
*/
@Module({
imports: [
McpSharedModule, PermissionsModule, QueryHelpersModule, PlacesModule, AuthModule, RealtimeModule, PluginGuardsModule,
AccommodationsDomainModule, AssignmentsDomainModule,
],
controllers: [DaysController],
providers: [DaysService, DayRemovalService, DaysMcp, DaysRpc],
exports: [DaysService],
})
export class DaysModule {}