feat(roadtrip): add daily scheduling and configurable day endings

This commit is contained in:
Maurice
2026-09-11 22:28:02 +02:00
parent 4f8605b529
commit 491cfccc56
124 changed files with 3512 additions and 354 deletions
@@ -1,5 +1,6 @@
import {
assignmentCreateRequestSchema,
assignmentEndDayRequestSchema,
assignmentMoveRequestSchema,
assignmentParticipantsRequestSchema,
assignmentTransportRequestSchema,
@@ -7,6 +8,14 @@ import {
import { describe, it, expect } from 'vitest';
it('requires a boolean for an explicit day end', () => {
expect(assignmentEndDayRequestSchema.parse({ end_day: true })).toEqual({ end_day: true });
expect(assignmentEndDayRequestSchema.parse({ end_day: false })).toEqual({ end_day: false });
for (const end_day of [1, 'true', null, undefined]) {
expect(assignmentEndDayRequestSchema.safeParse({ end_day }).success).toBe(false);
}
});
describe('assignmentCreateRequestSchema', () => {
it('requires a place_id; notes optional/nullable', () => {
expect(assignmentCreateRequestSchema.safeParse({ place_id: 2 }).success).toBe(true);
@@ -40,6 +40,7 @@ export const assignmentSchema = z.object({
notes: z.string().nullable().optional(),
assignment_time: z.string().nullable().optional(),
assignment_end_time: z.string().nullable().optional(),
end_day: z.boolean().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(),
@@ -78,6 +79,11 @@ export const assignmentTimeRequestSchema = z.object({
});
export type AssignmentTimeRequest = z.infer<typeof assignmentTimeRequestSchema>;
export const assignmentEndDayRequestSchema = z.object({
end_day: z.boolean(),
});
export type AssignmentEndDayRequest = z.infer<typeof assignmentEndDayRequestSchema>;
/**
* PUT /:id/notes (#2163) — edit the per-assignment note after creation.
* Deliberately uncapped like the create contract above: the REST create body