adds API docs
This commit is contained in:
@@ -12,6 +12,11 @@
|
||||
<div>
|
||||
<h5 class="font-semibold">Resources</h5>
|
||||
<ul class="mt-4 text-sm">
|
||||
<li>
|
||||
<a href="/docs/api/index.html"
|
||||
>API {$_("documentation")}</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/Flomp/wanderer/wiki"
|
||||
>{$_("documentation")}</a
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
searchDropdownItems = result.hits.map((h: Record<string, any>) => ({
|
||||
text: h.name,
|
||||
description: `${h.division} | ${
|
||||
description: `${h.division ? `${h.division} | ` : ""}${
|
||||
country_codes[h["country code"] as keyof typeof country_codes]
|
||||
}`,
|
||||
value: h,
|
||||
|
||||
@@ -203,7 +203,7 @@ export async function trails_create(trail: Trail, photos: File[], gpx: File | Bl
|
||||
const model = await waypoints_create({
|
||||
...waypoint,
|
||||
marker: undefined,
|
||||
});
|
||||
}, f);
|
||||
trail.waypoints.push(model.id!);
|
||||
}
|
||||
for (const summitLog of trail.expand.summit_logs) {
|
||||
|
||||
@@ -5,11 +5,11 @@ import { writable, type Writable } from "svelte/store";
|
||||
|
||||
export const waypoint: Writable<Waypoint> = writable(new Waypoint(0, 0));
|
||||
|
||||
export async function waypoints_create(waypoint: Waypoint) {
|
||||
export async function waypoints_create(waypoint: Waypoint, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch) {
|
||||
|
||||
waypoint.author = pb.authStore.model!.id
|
||||
|
||||
let r = await fetch('/api/v1/waypoint', {
|
||||
let r = await f('/api/v1/waypoint', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(waypoint),
|
||||
})
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
const cityItems = response.results[1].hits.map(
|
||||
(c: Record<string, any>) => ({
|
||||
text: c.name,
|
||||
description: `City | ${c.division} | ${
|
||||
description: `City ${c.division ? `| ${c.division} ` : ""}| ${
|
||||
country_codes[
|
||||
c["country code"] as keyof typeof country_codes
|
||||
]
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
const cityItems = response.results[1].hits.map(
|
||||
(c: Record<string, any>) => ({
|
||||
text: c.name,
|
||||
description: `City | ${c.division} | ${
|
||||
description: `City ${c.division ? `| ${c.division} ` : ""}| ${
|
||||
country_codes[
|
||||
c["country code"] as keyof typeof country_codes
|
||||
]
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
const result = await r.json();
|
||||
searchDropdownItems = result.hits.map((h: Record<string, any>) => ({
|
||||
text: h.name,
|
||||
description: `${h.division} | ${
|
||||
description: `${h.division ? `${h.division} | ` : ""}${
|
||||
country_codes[h["country code"] as keyof typeof country_codes]
|
||||
}`,
|
||||
value: h,
|
||||
|
||||
65
web/static/docs/api/index.html
Normal file
65
web/static/docs/api/index.html
Normal file
File diff suppressed because one or more lines are too long
1
web/static/docs/api/wanderer.openapi.json
Normal file
1
web/static/docs/api/wanderer.openapi.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user