App version management.

* DB migration adds app_versions table for managing known app versions.
* /ping reads app version from User-Agent header and responds with latest version if the app is OKO and its version is older than the latest one stored.
* Added endpoint /app-versions which
  * lists all known versions via GET
  * adds/updates a version via POST

#3
Fix #4
This commit is contained in:
zegkljan
2022-09-23 00:59:20 +02:00
parent c9377b04fc
commit 7c8a430f49
7 changed files with 187 additions and 42 deletions
+6
View File
@@ -4,6 +4,7 @@ import (
"io"
"time"
"github.com/coreos/go-semver/semver"
geojson "github.com/paulmach/go.geojson"
)
@@ -40,6 +41,11 @@ type BuildInfo struct {
// transport objects
type AppVersionInfo struct {
Version semver.Version `json:"version"`
Address string `json:"address"`
}
type Coords struct {
Lat float64 `json:"lat"`
Lng float64 `json:"lng"`