finishes trail create
This commit is contained in:
21
web/src/lib/stores/summit_log_store.ts
Normal file
21
web/src/lib/stores/summit_log_store.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { pb } from "$lib/constants";
|
||||
import { SummitLog } from "$lib/models/summit_log";
|
||||
import { writable, type Writable } from "svelte/store";
|
||||
|
||||
export const summitLog: Writable<SummitLog> = writable(new SummitLog(new Date().toISOString()));
|
||||
|
||||
export async function summit_logs_create(bodyParams?: { [key: string]: any; } | FormData) {
|
||||
const model = await pb
|
||||
.collection("summit_logs")
|
||||
.create<SummitLog>(bodyParams);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
export async function summit_logs_delete(id: string) {
|
||||
const success = await pb
|
||||
.collection("summit_logs_delete")
|
||||
.delete(id);
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -23,6 +23,31 @@ export async function trails_show(id: string, loadGPX?: boolean) {
|
||||
trail.set(response);
|
||||
}
|
||||
|
||||
export async function trails_create(bodyParams?: { [key: string]: any; } | FormData) {
|
||||
const model = await pb
|
||||
.collection("trails")
|
||||
.create<Trail>(bodyParams);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
export async function trails_update(id: string, bodyParams?: { [key: string]: any; } | FormData) {
|
||||
const model = await pb
|
||||
.collection("trails")
|
||||
.update<Trail>(id, bodyParams);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
export async function trails_delete(id: string) {
|
||||
const success = await pb
|
||||
.collection("trails")
|
||||
.delete(id);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
async function fetchGPX(trail: Trail) {
|
||||
if (!trail.gpx) {
|
||||
return "";
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
import { pb } from "$lib/constants";
|
||||
import { Waypoint } from "$lib/models/waypoint";
|
||||
import { writable, type Writable } from "svelte/store";
|
||||
|
||||
export const waypoint: Writable<Waypoint> = writable(new Waypoint(0, 0));
|
||||
|
||||
export async function waypoints_create(bodyParams?: { [key: string]: any; } | FormData) {
|
||||
|
||||
const model = await pb
|
||||
.collection("waypoints")
|
||||
.create<Waypoint>(bodyParams);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
export async function waypoints_delete(id: string) {
|
||||
const success = await pb
|
||||
.collection("waypoints")
|
||||
.delete(id);
|
||||
|
||||
return success;
|
||||
}
|
||||
Reference in New Issue
Block a user