Files
TREK/shared/src/index.ts
T
Maurice 1b5317a817 Give GPX tracks their own colour (#776)
Imported tracks all render in the same blue: the GPX/KML importers never
assign a category, so category_color is null for every one of them and
several walks in the same area are impossible to tell apart.

Adds a nullable route_color on places, kept out of the COALESCE group in
updatePlace so an explicit null can reset a track back to inheriting its
category colour. The hex is validated in the Nest controller rather than
in the shared contract: the update body is an open record on purpose, and
tightening it would mean removing PlacesController.update from the
ratchet-only body-contract allow-list.

The importers now hand each new track a colour of its own, picked from
the palette entries the trip is not already using. That happens in the
Nest service over the injected DatabaseService — the colour assignment is
new logic, and new logic does not belong in the legacy place service (see
server/src/nest/README.md). The field itself is only threaded through the
existing update/create statements, which the proportionality rule covers.

Also fixes duplicateTrip, whose explicit column list has been silently
dropping route_geometry all along, so a duplicated trip lost its tracks.
2026-07-28 07:25:36 +02:00

56 lines
2.2 KiB
TypeScript

/**
* @trek/shared — single source of truth for TREK's API contracts.
*
* Zod schemas defined here are consumed by BOTH the server (validation +
* inferred DTO types) and the client (typed requests/responses). A route is
* only considered "migrated" once its contract lives in this package.
*
* Layout: one folder per domain (e.g. src/trip/trip.schema.ts), plus the
* domain-agnostic primitives below. See the board card "Module blueprint".
*/
export * from './common/primitives.schema';
export * from './common/pagination.schema';
// Domain contracts
export * from './weather/weather.schema';
export * from './airport/airport.schema';
export * from './config/config.schema';
export * from './system-notice/system-notice.schema';
export * from './maps/maps.schema';
export * from './category/category.schema';
export * from './tag/tag.schema';
export * from './notification/notification.schema';
export * from './atlas/atlas.schema';
export * from './vacay/vacay.schema';
export * from './packing/packing.schema';
export * from './todo/todo.schema';
export * from './budget/budget.schema';
export * from './reservation/reservation.schema';
export * from './reservation/ki-reservation.schema';
export * from './airtrail/airtrail.schema';
export * from './day/day.schema';
export * from './assignment/assignment.schema';
export * from './place/place.schema';
export * from './place/track-colors';
export * from './collection/collection.schema';
export * from './trip/trip.schema';
export * from './trip-invite/trip-invite.schema';
export * from './collab/collab.schema';
export * from './file/file.schema';
export * from './journey/journey.schema';
export * from './share/share.schema';
export * from './settings/settings.schema';
export * from './appearance/appearance.schema';
export * from './backup/backup.schema';
export * from './auth/auth.schema';
export * from './oidc/oidc.schema';
export * from './oauth/oauth.schema';
export * from './admin/admin.schema';
// Sanitisation helpers — used by the client today, scoped here so the server
// has them ready if rich-text input ever ships.
export * from './sanitize/sanitize';
// i18n registry (language list + pure helpers — no locale data)
export * from './i18n/languages';