The Tours tab's list of the trip's tours gains the filter the plan's tour list has, and above the list a card with what the tours shown add up to: how many, how many are on a day and how many not, then per type distance, ascent and descent, and the three kinds of time apart, the router's for tours planned in TREK, the one an import brought, and the planned one with breaks. Nothing is added up across types. The filter narrows the list and the totals alike. Each tour counts once however many days it is on; the list is one row a tour. A value no tour has is left out rather than shown as zero, and a sum some tours lack is shown as at least that much, its info dot saying for how many of how many it is known. Paddling sums no heights: on the water a climb says nothing, and a planned paddle tour's heights would be the banks'. The card folds to its counts, remembered in this browser. The empty state for a filter that leaves nothing is shared by both lists now.
@trek/shared
Single source of truth for TREK's API contracts, expressed as Zod schemas and consumed by both the server (request validation + inferred DTO types) and the client (typed requests/responses).
This package is part of the incremental NestJS + React 19 migration (see the "Brownfield Rewrite" board). It is intentionally dormant until modules start importing it — adding it changes nothing for users.
Rules
- One folder per domain:
src/<domain>/<domain>.schema.ts(+.spec.ts). - Domain-agnostic building blocks live in
src/common/. - A route is only considered migrated once its contract lives here.
- Schemas are the source of truth; server DTOs and client types are inferred from them
(
z.infer<typeof schema>), never hand-duplicated.
Consumption (dev)
Both apps resolve @trek/shared to this package's TypeScript source:
- Server (
tsx): viapathsinserver/tsconfig.json. - Client (
vite): viaresolve.aliasinclient/vite.config.ts(+pathsfor the type-checker).
Production packaging (Docker / workspace wiring) is introduced in card F2, when the server first depends on this package at runtime. Until then prod builds are untouched.
Not yet here
The canonical error envelope is finalised in card F5 (it must match TREK's current Express error responses byte-for-byte), so it is deliberately not invented in F1.