adds api gpx upload route

This commit is contained in:
Christian Beutel
2024-03-21 18:46:25 +01:00
parent 01dfea0a03
commit 2ab0334579
22 changed files with 625 additions and 35 deletions

View File

@@ -13,7 +13,6 @@ export async function GET(event: RequestEvent) {
} catch (e: any) {
throw error(e.status, e);
}
}
export async function PUT(event: RequestEvent) {

View File

@@ -2,6 +2,16 @@ import { pb } from "$lib/pocketbase";
import { error, json, type RequestEvent } from "@sveltejs/kit";
import type { List } from "postcss/lib/list";
export async function GET(event: RequestEvent) {
try {
const r = await pb.collection('lists')
.getOne<List>(event.params.id as string, { expand: "trails,trails.waypoints,trails.category" })
return json(r)
} catch (e: any) {
throw error(e.status, e);
}
}
export async function POST(event: RequestEvent) {
const data = await event.request.json()
@@ -16,7 +26,7 @@ export async function POST(event: RequestEvent) {
export async function DELETE(event: RequestEvent) {
try {
const r = await pb.collection('lists').delete(event.params.id as string)
return json(r);
return json({ 'acknowledged': r });
} catch (e: any) {
throw error(e.status, e)
}