fix(ski-routing): no promise in a condition and no await in a loop, ski route type from its schema

ski-areas.service checks the pending load and download against null and
undefined, the area refresh lane recurses instead of awaiting in a loop,
TourSkiRoute is inferred from its schema, the ways answer is read by
complete === false, and /v1/routes no longer needs a truncated field.
This commit is contained in:
Maurice
2026-10-20 21:43:46 +02:00
parent d3f574f225
commit 6c66cff365
7 changed files with 42 additions and 37 deletions
+7 -9
View File
@@ -23,7 +23,6 @@ import {
type PaddleLock,
type PaddleRegionBoundary,
type PaddleRegionGraphStats,
type SkiRouteOptions,
type TourChange,
type TourFixedLeg,
type TourSourceHintChange,
@@ -194,20 +193,19 @@ export const TOUR_HIKING_PREFERENCES: JsonColumn<HikingPreferences | null> = {
fallback: () => null,
};
/** What a ski tour's legs were planned with: the piste router's options and the piste data build they ran on. */
export interface TourSkiRoute {
options: SkiRouteOptions;
build: string | null;
/** The legs the piste router planned, by the index of the point each starts at; absent where the save did not say. */
planned_legs?: number[];
}
/**
* What a ski tour's legs were planned with: the piste router's options and the
* piste data build they ran on. planned_legs names the legs the piste router
* planned, by the index of the point each starts at; absent where the save did not say.
*/
const tourSkiRouteSchema = z.object({
options: skiRouteOptionsSchema,
build: z.string().nullable(),
planned_legs: skiPlannedLegsSchema.optional(),
});
export type TourSkiRoute = z.infer<typeof tourSkiRouteSchema>;
/** A ski tour's piste router options. A broken row reads as none, and the planner offers the defaults. */
export const TOUR_SKI_ROUTE: JsonColumn<TourSkiRoute | null> = {
column: 'tours.ski_options',