feat(ferratas): keep loaded via ferratas in a tile cache on server and device, group segments, own look and count badge

This commit is contained in:
Maurice
2026-10-14 16:21:30 +02:00
parent a9882a6415
commit 160bc89e78
126 changed files with 5003 additions and 1153 deletions
+18
View File
@@ -1,4 +1,5 @@
import type { JsonColumn } from '../utils/json-column';
import { FERRATAS_RESULT_CAP, ferrataSchema, type Ferrata } from '@trek/shared';
import { z } from 'zod';
@@ -106,3 +107,20 @@ export const BUDGET_ITEM_TICKET: JsonColumn<{ items: { price?: string | number;
.loose(),
fallback: () => null,
};
/** What one cell of the via ferrata grid holds: its ferratas, and whether the Overpass answer they came from was cut. */
export interface FerrataTilePayload {
ferratas: Ferrata[];
truncated: boolean;
}
/**
* One via ferrata grid cell, as Overpass answered it. Checked against the wire
* contract, so a stored row can go out as it is. A broken row reads as a cell
* never fetched (null), and the next request asks Overpass for it again.
*/
export const FERRATA_TILE_PAYLOAD: JsonColumn<FerrataTilePayload | null> = {
column: 'ferrata_tiles.payload',
schema: z.object({ ferratas: z.array(ferrataSchema).max(FERRATAS_RESULT_CAP), truncated: z.boolean() }).nullable(),
fallback: () => null,
};