Centralize waypoint Yjs serialization in waypointFromYMap/waypointToYMap
Introduce waypoint-ymap.ts with typed helpers so all Yjs↔Waypoint conversions go through one place. New Waypoint fields now only need to be added once rather than in every consumer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
02f8a8be44
commit
9e2ca5595e
8 changed files with 63 additions and 52 deletions
|
|
@ -3,6 +3,7 @@ import type { Route } from "./+types/api.sessions";
|
|||
import { createSession, listSessions } from "~/lib/sessions";
|
||||
import { parseGpxAsync, extractWaypoints } from "@trails-cool/gpx";
|
||||
import { withDb } from "@trails-cool/db";
|
||||
import type { Waypoint } from "@trails-cool/types";
|
||||
|
||||
export async function action({ request }: Route.ActionArgs) {
|
||||
if (request.method !== "POST") {
|
||||
|
|
@ -19,7 +20,7 @@ export async function action({ request }: Route.ActionArgs) {
|
|||
return withDb(async () => {
|
||||
const session = await createSession({ callbackUrl, callbackToken });
|
||||
|
||||
let initialWaypoints: Array<{ lat: number; lon: number; name?: string; isDayBreak?: boolean; note?: string; osmId?: number; poiTags?: Record<string, string> }> | undefined;
|
||||
let initialWaypoints: Waypoint[] | undefined;
|
||||
let initialNoGoAreas: Array<{ points: Array<{ lat: number; lon: number }> }> | undefined;
|
||||
let initialNotes: string | undefined;
|
||||
if (gpx) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue