fixes serverside pb usage

This commit is contained in:
Christian Beutel
2025-04-18 14:15:20 +02:00
parent 5024ade9ba
commit 69a5bbb5b9
7 changed files with 15 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ import type { Feature, FeatureCollection, GeoJSON, GeoJsonProperties, Position }
import * as xmldom from 'xmldom';
import { bbox, splitMultiLineStringToLineStrings } from "./geojson_util";
import JSZip from "jszip";
import type { AuthRecord } from "pocketbase";
export async function gpx2trail(gpxString: string, fallbackName?: string) {
@@ -66,7 +67,7 @@ export async function gpx2trail(gpxString: string, fallbackName?: string) {
return { gpx: gpx, trail: trail }
}
export async function trail2gpx(trail: Trail) {
export async function trail2gpx(trail: Trail, user?: AuthRecord) {
if (!trail.expand?.gpx_data) {
throw Error("Trail has no GPX data")
}
@@ -81,7 +82,7 @@ export async function trail2gpx(trail: Trail) {
desc: trail.description ?? "",
time: trail.date ? new Date(trail.date) : new Date(),
keywords: `${trail.category ?? ""}, ${trail.location ?? ""}`,
author: { name: trail.author ?? "", email: get(currentUser)?.email ?? "" }
author: { name: trail.author ?? "", email: user?.email ?? "" }
}
if (!gpx.wpt) {