basic server

* basic untested implementation of server
* updating data not implemented yet
This commit is contained in:
zegkljan
2022-01-28 00:29:06 +01:00
commit 38318ca654
11 changed files with 1458 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
package models
import geojson "github.com/paulmach/go.geojson"
// core objects
type UserID int
type User struct {
ID UserID `json:"id"`
Name string `json:"name"`
}
type Feature struct {
ID int `json:"id"`
OwnerID *UserID `json:"owner_id"`
Name string `json:"name"`
Description *string `json:"description"`
Category *string `json:"category"`
Geometry geojson.Geometry `json:"geometry"`
}
// transport objects
type Update struct {
Create []Feature `json:"create"`
Update []Feature `json:"update"`
Delete []UserID `json:"delete"`
}
type HandshakeChallenge struct {
Name string `json:"name"`
Exists bool `json:"exists"`
}
type HandshakeResponse struct {
ID UserID `json:"id"`
Name string `json:"name"`
TilePackPath string `json:"tile_pack_path"`
}
type Data struct {
Users []User `json:"users"`
Features []Feature `json:"features"`
}