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
+4 -3
View File
@@ -30,6 +30,7 @@ const FIXTURES: Record<TrekWsEventName, Record<string, unknown>> = {
'day:reordered': { orderedIds: [2, 1] },
'roadtripVia:changed': { dayId: 2, vias: [{ id: 9, lat: 53.5, lng: 9.9 }] },
'roadtripTrack:changed': { dayId: 2, track: null },
'roadtripBoundary:changed': { boundaries: [{ day_number: 1, from_assignment_id: 9, to_assignment_id: null, fraction: 1 }] },
'dayNote:created': { dayId: 2, note: { id: 5 } },
'dayNote:updated': { dayId: 2, note: { id: 5 } },
'dayNote:deleted': { noteId: 5, dayId: 2 },
@@ -140,12 +141,12 @@ const DRIFT_VARIANTS: Partial<Record<TrekWsEventName, Record<string, unknown>[]>
};
describe('@trek/shared realtime event registry', () => {
it('WSEVT-REG-001: pins the authoritative inventory counts (71 trip + 32 user = 103)', () => {
it('WSEVT-REG-001: pins the authoritative inventory counts (72 trip + 32 user = 104)', () => {
// 67th to 69th trip event: the three collab:link:* a shared link emits.
// 70th and 71st: the road trip's vias and tracks, which used to be written silently.
expect(TREK_WS_TRIP_EVENT_NAMES).toHaveLength(71);
expect(TREK_WS_TRIP_EVENT_NAMES).toHaveLength(72);
expect(TREK_WS_USER_EVENT_NAMES).toHaveLength(32);
expect(TREK_WS_EVENT_NAMES).toHaveLength(103);
expect(TREK_WS_EVENT_NAMES).toHaveLength(104);
});
it('WSEVT-REG-002: every name is domain:action shaped and outside the reserved plugin: namespace', () => {
+2
View File
@@ -1,4 +1,5 @@
import { z } from 'zod';
import { roadtripDayBoundaryListSchema } from '../roadtrip/day-boundary.schema';
/**
* WS event contract registry — the single source of truth for every realtime
@@ -110,6 +111,7 @@ export const TREK_WS_EVENTS = {
scope: 'trip',
payload: z.object({ dayId: id, track: entity.nullable() }),
},
'roadtripBoundary:changed': { scope: 'trip', payload: roadtripDayBoundaryListSchema },
// ── Day notes ────────────────────────────────────────────────────────────
'dayNote:created': { scope: 'trip', payload: z.object({ dayId: id, note: entity }) },