feat(tours): the assistant edits stations, reverses and closes tours, sets breaks, colour and copies, and writes ski and paddle plans

City walk changes take edit, reverse and close_loop; edits alone keep the
saved way and never ask the router. update_tour turns a hike round or closes
its loop with reshape. New MCP tools mirror the Tours tab's REST writes and
reads: update_tour_details, set_tour_route_color, copy_tour,
classify_ski_track, set_paddle_plan, decide_paddle_obstacles,
restore_recorded_track, get_tour_trail_details and find_horse_routes, with
change cards, undo where the answer keeps the values before, and broadcast
parity cases.
This commit is contained in:
Maurice
2026-10-23 21:07:41 +02:00
parent c6b3f609b7
commit 767d91146a
68 changed files with 3574 additions and 39 deletions
@@ -162,6 +162,12 @@ export interface TourInsert {
}
/** What a route edit replaces on an existing tour: the type and everything that belongs to it. */
/** The planned times of a tour as P8 writes them, null where there is none. */
interface TourTimesUpdate {
planned_duration_minutes: number | null;
break_additional_minutes: number | null;
}
export type TourUpdate = Omit<
TourInsert,
| 'place_id'
@@ -883,6 +889,23 @@ export class ToursRepository extends TrekRepository<Tours> {
return Number(result.numUpdatedRows ?? 0) > 0;
}
/**
* P8: a tour's planned times alone, as update_tour_details changes them;
* nothing else of the tour is touched. Returns whether a row of that trip was updated.
*/
async updateTimesInTrip(trip_id: number, place_id: number, input: TourTimesUpdate): Promise<boolean> {
const result = await this.db()
.updateTable('tours')
.set({
planned_duration_minutes: input.planned_duration_minutes,
break_additional_minutes: input.break_additional_minutes,
})
.where('place_id', '=', place_id)
.where('place_id', 'in', (eb) => eb.selectFrom('places').select('id').where('trip_id', '=', trip_id))
.executeTakeFirst();
return Number(result.numUpdatedRows ?? 0) > 0;
}
/**
* The paddle plan of a recorded track of the trip: its speeds, the marks
* laid onto it and the moving time they make. The track itself is not