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:
Maurice
2026-11-14 17:48:57 +01:00
parent 535761dbd5
commit bac4599d64
40 changed files with 510 additions and 96 deletions
@@ -4,6 +4,7 @@ import {
assignmentMoveRequestSchema,
assignmentParticipantsRequestSchema,
assignmentSchema,
assignmentStayRequestSchema,
assignmentTransportRequestSchema,
} from './assignment.schema';
@@ -52,6 +53,15 @@ it('requires a boolean for an explicit day end', () => {
}
});
it('takes the stay of one visit as whole minutes up to a week, or null for the place stay (#3092)', () => {
for (const stay_minutes of [0, 45, 10_080, null]) {
expect(assignmentStayRequestSchema.parse({ stay_minutes })).toEqual({ stay_minutes });
}
for (const stay_minutes of [-1, 1.5, 10_081, '30', undefined]) {
expect(assignmentStayRequestSchema.safeParse({ stay_minutes }).success).toBe(false);
}
});
describe('assignmentCreateRequestSchema', () => {
it('requires a place_id; notes optional/nullable', () => {
expect(assignmentCreateRequestSchema.safeParse({ place_id: 2 }).success).toBe(true);