reverses waypoint relation

This commit is contained in:
Christian Beutel
2025-09-12 17:48:41 +02:00
parent 9c628c6511
commit 73d20b1cbc
19 changed files with 238 additions and 115 deletions

View File

@@ -15,7 +15,7 @@ export async function GET(event: RequestEvent) {
t.expand = {} as any
}
t.expand?.waypoints?.sort((a, b) => (a.distance_from_start ?? 0) - (b.distance_from_start ?? 0))
t.expand?.waypoints_via_trail?.sort((a, b) => (a.distance_from_start ?? 0) - (b.distance_from_start ?? 0))
}
return json(r)
} catch (e: any) {

View File

@@ -84,7 +84,7 @@ export async function GET(event: RequestEvent) {
l.expand.author.isLocal = false
}
})
t.expand?.waypoints?.forEach(w => {
t.expand?.waypoints_via_trail?.forEach(w => {
w.photos = w.photos.map(p =>
`${origin}/api/v1/files/waypoints/${w.id}/${p}`
@@ -131,7 +131,7 @@ export async function GET(event: RequestEvent) {
await enrichRecord(event.locals.pb, t);
// sort waypoints by distance
t.expand?.waypoints?.sort((a, b) => (a.distance_from_start ?? 0) - (b.distance_from_start ?? 0))
t.expand?.waypoints_via_trail?.sort((a, b) => (a.distance_from_start ?? 0) - (b.distance_from_start ?? 0))
return json(t)
} catch (e: any) {
return handleError(e)