adds API docs
This commit is contained in:
18
CHANGELOG.md
18
CHANGELOG.md
@@ -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
|
# v0.1.1
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
|
|||||||
16
db/main.go
16
db/main.go
@@ -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
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -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 ./migrations/migration.dump /meili_data/dumps/migration.dump
|
||||||
COPY ./entrypoint.sh /entrypoint.sh
|
COPY ./entrypoint.sh /entrypoint.sh
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
<div>
|
<div>
|
||||||
<h5 class="font-semibold">Resources</h5>
|
<h5 class="font-semibold">Resources</h5>
|
||||||
<ul class="mt-4 text-sm">
|
<ul class="mt-4 text-sm">
|
||||||
|
<li>
|
||||||
|
<a href="/docs/api/index.html"
|
||||||
|
>API {$_("documentation")}</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/Flomp/wanderer/wiki"
|
<a href="https://github.com/Flomp/wanderer/wiki"
|
||||||
>{$_("documentation")}</a
|
>{$_("documentation")}</a
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
searchDropdownItems = result.hits.map((h: Record<string, any>) => ({
|
searchDropdownItems = result.hits.map((h: Record<string, any>) => ({
|
||||||
text: h.name,
|
text: h.name,
|
||||||
description: `${h.division} | ${
|
description: `${h.division ? `${h.division} | ` : ""}${
|
||||||
country_codes[h["country code"] as keyof typeof country_codes]
|
country_codes[h["country code"] as keyof typeof country_codes]
|
||||||
}`,
|
}`,
|
||||||
value: h,
|
value: h,
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ export async function trails_create(trail: Trail, photos: File[], gpx: File | Bl
|
|||||||
const model = await waypoints_create({
|
const model = await waypoints_create({
|
||||||
...waypoint,
|
...waypoint,
|
||||||
marker: undefined,
|
marker: undefined,
|
||||||
});
|
}, f);
|
||||||
trail.waypoints.push(model.id!);
|
trail.waypoints.push(model.id!);
|
||||||
}
|
}
|
||||||
for (const summitLog of trail.expand.summit_logs) {
|
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 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
|
waypoint.author = pb.authStore.model!.id
|
||||||
|
|
||||||
let r = await fetch('/api/v1/waypoint', {
|
let r = await f('/api/v1/waypoint', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(waypoint),
|
body: JSON.stringify(waypoint),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
const cityItems = response.results[1].hits.map(
|
const cityItems = response.results[1].hits.map(
|
||||||
(c: Record<string, any>) => ({
|
(c: Record<string, any>) => ({
|
||||||
text: c.name,
|
text: c.name,
|
||||||
description: `City | ${c.division} | ${
|
description: `City ${c.division ? `| ${c.division} ` : ""}| ${
|
||||||
country_codes[
|
country_codes[
|
||||||
c["country code"] as keyof typeof country_codes
|
c["country code"] as keyof typeof country_codes
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -142,7 +142,7 @@
|
|||||||
const cityItems = response.results[1].hits.map(
|
const cityItems = response.results[1].hits.map(
|
||||||
(c: Record<string, any>) => ({
|
(c: Record<string, any>) => ({
|
||||||
text: c.name,
|
text: c.name,
|
||||||
description: `City | ${c.division} | ${
|
description: `City ${c.division ? `| ${c.division} ` : ""}| ${
|
||||||
country_codes[
|
country_codes[
|
||||||
c["country code"] as keyof typeof country_codes
|
c["country code"] as keyof typeof country_codes
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
const result = await r.json();
|
const result = await r.json();
|
||||||
searchDropdownItems = result.hits.map((h: Record<string, any>) => ({
|
searchDropdownItems = result.hits.map((h: Record<string, any>) => ({
|
||||||
text: h.name,
|
text: h.name,
|
||||||
description: `${h.division} | ${
|
description: `${h.division ? `${h.division} | ` : ""}${
|
||||||
country_codes[h["country code"] as keyof typeof country_codes]
|
country_codes[h["country code"] as keyof typeof country_codes]
|
||||||
}`,
|
}`,
|
||||||
value: h,
|
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
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user