mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
fix(roadtrip): keep the stay on each visit, not on the place (#3092)
A nullable day_assignments.stay_minutes holds the stay of one visit; a visit without one keeps reading the place's duration, so existing trips drive as before. REST PUT /trips/:tripId/assignments/:id/stay and the MCP tool set_assignment_stay write it with day_edit.
This commit is contained in:
@@ -42,6 +42,10 @@ export const assignmentSchema = z.object({
|
||||
assignment_time: z.string().nullable().optional(),
|
||||
assignment_end_time: z.string().nullable().optional(),
|
||||
end_day: z.boolean().optional(),
|
||||
// How long the drive stands at this visit, in minutes (#3092). Null, or absent on an
|
||||
// older server, reads the place's own duration_minutes, so a place planned twice can
|
||||
// be stopped at on one visit and only driven past on the other.
|
||||
stay_minutes: z.number().nullable().optional(),
|
||||
// Per-segment travel mode (#1281): the transport mode of the leg LEAVING this
|
||||
// stop for the next one. null = inherit the day's default_transport_mode.
|
||||
leg_transport_mode: z.string().nullable().optional(),
|
||||
@@ -105,6 +109,23 @@ export const assignmentEndDayRequestSchema = z.object({
|
||||
});
|
||||
export type AssignmentEndDayRequest = z.infer<typeof assignmentEndDayRequestSchema>;
|
||||
|
||||
/**
|
||||
* PUT /:id/stay (#3092) — how long the drive stands at this one visit, in whole
|
||||
* minutes, a week at most like the road trip's own stay bounds. Zero is a visit
|
||||
* driven past without stopping; null hands the visit back to the stay its place
|
||||
* carries (`places.duration_minutes`).
|
||||
*/
|
||||
export const assignmentStayRequestSchema = z.object({
|
||||
stay_minutes: z.number().int().min(0).max(10_080).nullable(),
|
||||
});
|
||||
export type AssignmentStayRequest = z.infer<typeof assignmentStayRequestSchema>;
|
||||
|
||||
/** What a write to one assignment answers with: the assignment as the day list reads it. */
|
||||
export const assignmentResponseSchema = z.object({
|
||||
assignment: assignmentSchema,
|
||||
});
|
||||
export type AssignmentResponse = z.infer<typeof assignmentResponseSchema>;
|
||||
|
||||
/**
|
||||
* PUT /:id/notes (#2163) — edit the per-assignment note after creation.
|
||||
* Deliberately uncapped like the create contract above: the REST create body
|
||||
|
||||
Reference in New Issue
Block a user