reverses waypoint relation
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user