adds API docs

This commit is contained in:
Christian Beutel
2024-03-23 20:19:20 +01:00
parent 6f01cecc22
commit 77b87e2d96
12 changed files with 113 additions and 9 deletions

View File

@@ -1,3 +1,21 @@
# v0.2.0
## Features
- when creating/editing a trail you can now drag & drop photos into the photo section to upload them
- you can now attach photos to waypoints
- you can now edit the "Distance", "Elevation Gain" and "Est. Duration" fields
- waypoint markers can now be moved with drag & drop
- lists can now be displayed as a map showing all trails contained in the list
- you can now prevent users from signing up by setting the `DISABLE_SIGNUP` environment variable to `true`
- you can now upload GPX files via the API to create trails. Check the [documentation](https://github.com/Flomp/wanderer/wiki/API#upload-trails) for more info.
- the city index now includes states
> Note: for city states to show up in your search you have to delete your data.ms folder if you already have a previous installation of wanderer. The indices will then be rebuilt on startup.
## Docs
- added complete API documentation
# v0.1.1
## Bug fixes

View File

@@ -115,6 +115,22 @@ func main() {
}
}
// bootstrap meilisearch
query = app.Dao().RecordQuery("trails")
trails := []*models.Record{}
if err := query.All(&trails); err != nil {
return err
}
for _, trail := range trails {
log.Println(trail)
if err := indexRecord(trail, client); err != nil {
return err
}
}
return nil
})

View File

@@ -1,4 +1,4 @@
FROM getmeili/meilisearch:v1.7
FROM getmeili/meilisearch:v1.6.2
COPY ./migrations/migration.dump /meili_data/dumps/migration.dump
COPY ./entrypoint.sh /entrypoint.sh

View File

@@ -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

View File

@@ -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,

View File

@@ -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) {

View File

@@ -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),
})

View File

@@ -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
]

View File

@@ -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
]

View File

@@ -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,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long