mirror of
https://github.com/Cernobor/oko-server.git
synced 2025-02-24 08:27:17 +00:00
* foreign keys always enabled on each connection * implemented data update (create, update, delete)
47 lines
990 B
Go
47 lines
990 B
Go
package models
|
|
|
|
import geojson "github.com/paulmach/go.geojson"
|
|
|
|
// core objects
|
|
|
|
type UserID int
|
|
type FeatureID int
|
|
|
|
type User struct {
|
|
ID UserID `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type Feature struct {
|
|
ID FeatureID `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 []FeatureID `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"`
|
|
}
|