mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user